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

Package should include private lib assets from package ref #5103

Closed
mhutch opened this issue Apr 21, 2017 · 4 comments
Closed

Package should include private lib assets from package ref #5103

mhutch opened this issue Apr 21, 2017 · 4 comments
Assignees
Labels
Product:NuGetizer A 1st party alternative to pack

Comments

@mhutch
Copy link

mhutch commented Apr 21, 2017

When building a NuGetizer package, if the project has PackageReferences with PrivateAssets=lib, then those references are copied to the output directory. However, they are not included in the the package.

This is important, for example, for msbuild tasks that depend on other assemblies and need them to be bundled alongside the tasks assembly.

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

@mhutch mhutch added the Product:NuGetizer A 1st party alternative to pack label Apr 21, 2017
@mhutch mhutch changed the title Package should include private lib assets from package ref with Package should include private lib assets from package ref Apr 22, 2017
@kzu kzu self-assigned this Apr 28, 2017
kzu added a commit to NuGet/NuGet.Build.Packaging that referenced this issue Jun 8, 2017
Fixes NuGet/Home#5103

This is only performed for resolved NuGet artifacts that have
one of the specified values in the referenced NuGet specification at
https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#controlling-dependency-assets.

This minimizes the impact of the new inference and preserves existing behavior.
@mhutch mhutch reopened this Jun 28, 2017
@mhutch
Copy link
Author

mhutch commented Jun 28, 2017

This does not work for transitive package references :(

@kzu
Copy link

kzu commented Jul 11, 2017

Ok, it looks like this will need some deeper inspection of the artifacts that nuget generates to determine this, because I'm not sure we're getting all the info we need in plain MSBuild to distinguish them (i.e. no %(PrivateAssets) metadata on assets resolved from nuget?

kzu added a commit to devlooped/nugetizer that referenced this issue Sep 30, 2020
When using `<PackageReference PrivateAssets=all `, transitive dependencies were not being brough in. This required package authors to reference explicitly each and every package they wanted packaged as private assets. This was particularly annoying for build and analyzer packages, which need to package all their dependencies privately.

This commit leverages the SDK-provided `RunResolvePackageDependencies` which returns the transitive closure of all referenced packages as a list of package>parent list. We use that to add the concept of "implicit package references" that basically share the PrivateAssets=all that brought them in. The inference target then just considers both `@(PackageReference)` as well as `@(ImplicitPackageReference)` to determine the primary output dependencies to pack, but otherwise the existing logic remains unchanged.

This behavior still honors the `Pack=false` on the PackageReference, but also skips the implificly defined packages like NETStandard.Library and Microsoft.NETCore.

Fixes NuGet/Home#5103.
@kzu
Copy link

kzu commented Oct 4, 2020

Full transitive support added in NuGetizer @mhutch. Feel free to close this :)

@aortiz-msft
Copy link
Contributor

Closing per last comment. Also, this issue was for Nugetizer :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product:NuGetizer A 1st party alternative to pack
Projects
None yet
Development

No branches or pull requests

5 participants