Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGets with native UWP and .NET core runtimes #5042

Closed
mattleibow opened this issue Apr 17, 2017 · 3 comments
Closed

NuGets with native UWP and .NET core runtimes #5042

mattleibow opened this issue Apr 17, 2017 · 3 comments
Labels
Resolution:Question This issues appears to be a question, not a product defect

Comments

@mattleibow
Copy link

mattleibow commented Apr 17, 2017

I am wondering how to create a package that contains native payloads for both UWP and .NET Core clients.

I am building SkiaSharp which supports both UWP apps and .NET Core (Windows 7+). My initial idea was to create a NuGet using a .targets file to include the native payloads:

<file src="output/uwp/SkiaSharp.UWP.targets" target="build\uap10.0\SkiaSharp.Windows.targets" />
<file src="output/uwp/x64/libskia_uwp.dll" target="build\uap10.0\x64\libskia_uwp.dll" />
<file src="output/uwp/x86/libskia_uwp.dll" target="build\uap10.0\x86\libskia_uwp.dll" />
<file src="output/uwp/arm/libskia_uwp.dll" target="build\uap10.0\arm\libskia_uwp.dll" /> 

This worked fine, but then I added .NET Core support (via .NET Standard support). Also, I added the win7 native bits:

<file src="output/windows/x64/libSkiaSharp.dll" target="runtimes/win7-x64/native/libSkiaSharp.dll" /> 
<file src="output/windows/x86/libSkiaSharp.dll" target="runtimes/win7-x86/native/libSkiaSharp.dll" /> 

This worked fine for .NET Core. But, this now had issues for UWP: it installed the win7 dlls into the UWP app. This resulted in both the UWP dlls from the .targets file and the win7 dlls. Not only did this cause issues with the build, but was invalid (win7 dll won't work on UWP). My solution was to add the UWP dlls into the runtimes as well:

<file src="output/uwp/x64/libSkiaSharp.dll" target="runtimes/win10-x64/native/libSkiaSharp.dll" /> 
<file src="output/uwp/x86/libSkiaSharp.dll" target="runtimes/win10-x86/native/libSkiaSharp.dll" /> 
<file src="output/uwp/arm/libSkiaSharp.dll" target="runtimes/win10-arm/native/libSkiaSharp.dll" /> 

This now "worked" for both if I publish .NET Core apps with win7 and install the NuGet into UWP apps. But, this now causes issues if I am building/publishing .NET Core apps on Windows 10. The build system selects the win10 directory for the runtimes (as it should), but these dlls (Windows Universal) are not supported by .NET Core.

Is there some way to let NuGet know that a dll is just for UWP, or am I building my universal dlls wrong?

@eerhardt
Copy link

@ericstj @emgarten - Can you select native assets based on a TFM? It sounds like we need a different native asset on netcoreapp than when used on uap.

@emgarten emgarten added the Resolution:Question This issues appears to be a question, not a product defect label Apr 20, 2017
@emgarten
Copy link
Member

Support for runtimes/{rid}/nativeassets/{tfm}/{any?} was added with #2782

Set a min client version of 3.5.0 in your nuspec to ensure that consumers have the correct client version to pick up this nupkg path.

@mattleibow
Copy link
Author

Awesome! Thanks!

Just wanted to add that to use NuGet v3.5 in VS 2015, you may have to install the vsix: http://dist.nuget.org/

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution:Question This issues appears to be a question, not a product defect
Projects
None yet
Development

No branches or pull requests

3 participants