0

I created a class library project and a shared project in visual studio 2015.

The class library is referencing the shared project and all is well at this point.

I want to use NuGet to pack this library project with its symbols but the packing only includes source files from the class library and not from the shared project.

How could I proceed?

Stécy
  • 11,951
  • 16
  • 64
  • 89

1 Answers1

0

The nuget pack command has an option -IncludeReferencedProjects that I believe is what you are going for.

Include referenced projects either as dependencies or as part of the package. If a referenced project has a corresponding nuspec file that has the same name as the project, then that referenced project is added as a dependency. Otherwise, the referenced project is added as part of the package.

Basically, if your shared project is also a package, nuget is smart enough to include it via a nuget package dependency. If the shared project is "just" a project, then it includes the compiled .dlls as a part of the package you are building.

Frank Bryce
  • 8,076
  • 4
  • 38
  • 56
  • You are aware that a shared project does not produce any output by itself? Therefore there is no nuspec to associate it with. I'll try the -IncludeReferencedProjects and see if makes a difference. – Stécy Apr 08 '16 at 19:52
  • Tried the switch and it has no effect. – Stécy Apr 08 '16 at 20:03
  • are you using `nuget pack` from the command line, or some tool? What does your nuspec file look like? – Frank Bryce Apr 10 '16 at 04:41
  • Using the command line and no nuspec file. Only the csproj is given. – Stécy Apr 11 '16 at 11:37
  • I just tested this on a simple setup, and it seems to work just fine. I added the `-Build` option, too, to make sure that all the dependent projects were built before packing. To test, try installing the *.nupkg file from a local folder on an empty project and see if the *.dlls for the dependent projects are there is included. – Frank Bryce Apr 12 '16 at 01:45