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

Contents and .targets in package dependencies are not included in the build process #6388

Closed
dotMorten opened this issue Jan 5, 2018 · 2 comments

Comments

@dotMorten
Copy link

dotMorten commented Jan 5, 2018

In a .NET Standard project I'm referencing a NuGet Package, that in turn references other nuget packages to perform bait'n'switch. For instance sub-packages for UWP, Android and iOS. These sub packages deploy various resources like native libraries, shaders etc.

Next you create your app heads for iOS, Android and UWP, and you reference your .NET Standard project. In turn the NuGet package also gets available for compilation. You can even access the APIs in the package from the project heads. However, the .targets and contents down in the package dependencies are not included, and thus at runtime, your app will crash, because the native libs and resources doesn't get deployed.

The workaround currently is to set "privateAssets=none" on the nuget reference, but this is very counter intuitive and is going to hurt my customers. They would expect things to "just work" when it compiles fine. At no point has my nuget package said to ignore .targets and contents (the dependency list in the nuget package does specify include="all" already, but it seems to not actually be doing that).

The interesting bit is, this issue doesn't affect UWP, but it affects WPF, iOS and Android.

Even worse, when using packages.config instead of Package Reference in your project head, you don't get any access to the APIs from the nuget package in the project heads. You have to manually add the package again in the project head.

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): VS UI

NuGet version (x.x.x.xxx): 4.5.0.4685
VS version (if appropriate): 15.5.2
OS version (i.e. win10 v1607 (14393.321)): win10 v1709 (16299.98)
Worked before? If so, with which NuGet version: AFAIK never worked

Sample Project

I can provide packages that reproduces the issue, but due to them having NDA content, it would have to be done through a back-channel.

/CC @rohit21agrawal helped me track down the issue. He understands it better and said he would add some more details here

@nkolev92
Copy link
Member

nkolev92 commented Jan 8, 2018

Related #6091, there we want to change the default for build assets to allow them to flow transitively.

@nkolev92
Copy link
Member

The buildTransitive has been implemented to allow authors to deliver targets transitively.

https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#controlling-dependency-assets has details about the defaults.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants