It is not possible to pack multiple projects into one NuGet package
See original GitHub issueSteps to reproduce
Using VS 2017 and new .csproj format
- Create CommonLib.csproj project, it should not be published as NuGet package.
- Create ProjectA.csproj project, it should be published as NuGet package.
- Add project reference from ProjectA to CommonLib.
- Pack the ProjectA (with Visual Studio or CLI).
Expected behavior
ProjectA.nupkg is created. It contains ProjectA.dll and CommonLib.dll.
Actual behavior
ProjectA.nupkg is created. It contains only ProjectA.dll. CommonLib is added as a NuGet dependency.
Additional info
I have tried to add <IsPackable>false</IsPackable>
property to the CommonLib.csproj, but it is not take into the consideration.
Environment data
dotnet --info
output:
NET Command Line Tools (1.0.1)
Product Information: Version: 1.0.1 Commit SHA-1 hash: 005db40cd1
Runtime Environment: OS Name: Windows OS Version: 6.1.7601 OS Platform: Windows RID: win7-x64 Base Path: C:\Program Files\dotnet\sdk\1.0.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Creating one NuGet package from multiple projects in ...
If you have more than one project in VS and your Pack file is dependant on another project then both need to be...
Read more >It is not possible to pack multiple projects into one NuGet ...
Yes, that is definitely possible to just merge the two projects together, and this is a workaround that I will use. But I...
Read more >Nugget package of multiple projects? : r/dotnet
I wrote an for my company that I separated into multiple projects (data access, business logic, and a service layer).
Read more >Producing Multiple Related NuGet Packages from a Single ...
Just create a couple of class libraries, add project references between them, and when you run dotnet pack , it just does the...
Read more >[Solved]-Creating one NuGet package from multiple projects ...
If you have more than one project in VS and your Pack file is dependant on another project then both need to be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
While it would probably be nice to have (especially for legacy stuff). Isn’t it a bit strange that there are 2 projects when it is distributed as 1 package? Unless there are some external factors into play forcing you to separate shouldn’t it simply be 1 project since it is distributed as 1 package?
@Patrickkk, although the issue is closed, I wanted to provide an example scenario when multiple projects are needed. We use C# and F# together in a single solution, half of the projects are written in each language.