Nuget 2.5 doesn't add project references as a depedency

Topics: General
Apr 30, 2013 at 8:02 PM
According to,
If the referenced project has corresponding nuspec file, e.g. there is a file called proj1.nuspec in the same directory as proj1.csproj, then this project is added as a dependency to the package, using the id and version read from the nuspec file.
When I create a solution with two projects, both of which have .nuspec files with the same name as their .csproj files, with a dependency from one project to the other, install NuGetPowerTools, enable package build, enable package restore, and build solution, the *.nupkg files are generated, but opening them with package explorer doesn't reveal the dependency. The fallback scenario
Otherwise, the files of the referenced project are bundled into the package. Then projects referenced by this project will be processed using the sames rules recursively.
also doesn't happen.

I'm using nuget 2.5.40416.9020 with VS 2008. How do I enable this?
May 9, 2013 at 7:29 PM
The paragraph in the doc refers to the nuget.exe pack command. It doesn't apply to the NuGetPowerTools package, nor the package restore.
May 17, 2013 at 12:54 AM
  • I've created a new solution in VS2012 Update 2.
  • It has ProjectB C#, .NET 4.5 class library with a public ClassB and a public static method.
  • It also has ProjectA C#, .NET 4.5 class library with a public ClassA and a public static method which calls ClassB's method.
  • ProjectA has a project reference to ProjectB.
  • ProjectB has a ProjectB.nuspec file next to the ProjectB.csproj file and it contains a <metadata> section only with no <dependencies> element.
  • ProjectA has a ProjectA.nuspec file next to the ProjectA.csproj file and it contains a <metadata> section only with no <dependencies> element.
  • I have nuget.exe 2.5.40416.9020 and I execute "nuget.exe pack ProjectA.csproj"
The resulting ProjectA.1.0.nupkg file includes ProjectA.dll but not ProjectB.dll (as expected). The ProjectA.nuspec file inside the ProjectA.nupkg has an empty <dependencies> element where it should contain a reference to the ProjectB package.
May 17, 2013 at 1:17 AM
It seems that specifying the -IncludeProjectReferences switch on the nuget.exe pack command resolves the issue. However it also seems that the BuildPackage target in nuget.targets doesn't have an easy mechanism to include this switch.
May 20, 2013 at 7:34 PM
Why isn't it easy to include this switch? Can't you open the .targets file and add the switch manually?