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

It is not possible to pack multiple projects into one NuGet package #5360

Closed
nguerrera opened this issue Jun 7, 2017 · 8 comments
Closed
Labels
Resolution:Duplicate This issue appears to be a Duplicate of another issue

Comments

@nguerrera
Copy link

From @quarion on May 29, 2017 13:34

Steps to reproduce

Using VS 2017 and new .csproj format

  1. Create CommonLib.csproj project, it should not be published as NuGet package.
  2. Create ProjectA.csproj project, it should be published as NuGet package.
  3. Add project reference from ProjectA to CommonLib.
  4. 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

Copied from original issue: dotnet/cli#6707

@nguerrera
Copy link
Author

From @Patrickkk on June 2, 2017 7:48

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?

@nguerrera
Copy link
Author

From @quarion on June 2, 2017 8:42

Yes, that is definitely possible to just merge the two projects together, and this is a workaround that I will use.

But I would imagine, that there might be some valid scenarios similar to this one:

CommonLib.csproj <- this provide no value on its own, so it should not be published.
ProjectA.csproj <- Published as NuGet. Refers CommonLib, so it would need to contain it as part of the package.
ProjectB.csproj <- Published as NuGet. Refers CommonLib, so it would need to contain it as part of the packages.

@mishra14
Copy link
Contributor

mishra14 commented Jun 8, 2017

ping: @emgarten @rohit21agrawal

@rohit21agrawal rohit21agrawal added the Resolution:Duplicate This issue appears to be a Duplicate of another issue label Jun 8, 2017
@rohit21agrawal
Copy link
Contributor

Closing as duplicate of : #3891

@greatkeke
Copy link

I wonder if it will be possible to pack multiple projects into one NuGet package?

@jangix
Copy link

jangix commented Nov 11, 2019

My solution:

  1. Create package from A.csproj
  2. Create package from Common.csproj
  3. Open A.nupkg and Common.nupkg with 7zip
  4. Copy Common.lib from Common.nupkg to the same folder of the A.nupkg
  5. From Common.nuspec file copy dipendecies nodes and merge with same nodes of the A.nuspec
  6. Delete Common.nupkg and push customized A.nupkg to the your repository.

@AraHaan
Copy link

AraHaan commented Jan 8, 2021

Another solution: nupkg is just another zip file so just generate it with a tool you make instead.

@daiplusplus
Copy link

@jangix Can you post an example input and output .nuspec files? I'm having trouble reproducing your steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution:Duplicate This issue appears to be a Duplicate of another issue
Projects
None yet
Development

No branches or pull requests

7 participants