I am able to replicate this scenario:
This is the structure of my . Net solution:
LibC - project --references external Nuget package
LibB - project ---references LibC
LibA - project --references LibB
When I pack LibA with includeReferenedProjects option, I can see LibB. How do I prevent nuget package/lib folder from containing LibC dll and external Nuget package? Those are internal to the solution.
Shouldn't LibA package only contain LibB dll?
Why doesn't Nuget package contain only referenced projects?
This is a known issue on Github Issue 2897 . But NuGet team are not planning to implement this feature at the current time.
As workaround for this issue, you can create a .nupsec
only include the referenced project LinB dll:
Check: Create nuget package from dlls
If you do not want to create the .nupsec
file, you can download NuGet Package Explorer from Microsoft store, then edit the package info, delete the LibC dll and remove the nuget dependency(Edit->Edit Metadata->Edit dependebcies)
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.