This project has moved. For the latest updates, please go here.

Ignore an automatically discovered nuget package dependency?

Jul 1, 2014 at 3:23 PM
I notice that the pack process included a dependency in the nuspec file that I don't want there. Is there a way to prevent that from happening?
Coordinator
Jul 1, 2014 at 6:03 PM
By default if you don't use a .nuspec file, NuGet will include all project dependencies in the NuGet package it generates. The solution is to provide a .nuspec file beside your project file; so if you have MyProject.csproj, you need to have a MyProject.nuspec file in the same folder. Then in the .nuspec file you explicitly specify which dependencies you want to have included, if any. If you just use the default .nuspec file that NuGet generates it will not include any project dependencies. To generate your .nuspec file, you just need to run the command "Nuget.exe spec" from the command line in the same directory as your .csproj file. For more information on .nuspec files see http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package.
Jul 2, 2014 at 9:05 PM
Do I have to tell the script to use the nuspec file? You can see where I've got the file in there https://github.com/alexdresko/Konami/tree/master/Konami.Core

But the log looks like this:

1> VERBOSE: About to run Pack command '&
1> "C:\projects\Git\Konami\Konami.Core\PostBuildScripts\NuGet.exe" pack
1> "C:\projects\Git\Konami\Konami.Core\Konami.Core.csproj" -OutputDirectory
1> "C:\projects\Git\Konami\Konami.Core\bin\Release" -Properties
1> Configuration="Release"`;Platform="AnyCPU" -NonInteractive -Symbols'.
1> Attempting to build package from 'Konami.Core.csproj'.
Jul 2, 2014 at 9:09 PM
Actually, it appears to be using values from the nuspec file... it's just ignoring the explicit dependencies I've specified and it includes the dependencies found in the .csproj file instead.
Jul 2, 2014 at 9:11 PM
OKOKOK... I should have included the rest of the log. Makes sense now. But how do I get it to ignore the packages.config?

1> VERBOSE: About to run Pack command '&
1> "C:\projects\Git\Konami\Konami.Core\PostBuildScripts\NuGet.exe" pack
1> "C:\projects\Git\Konami\Konami.Core\Konami.Core.csproj" -OutputDirectory
1> "C:\projects\Git\Konami\Konami.Core\bin\Release" -Properties
1> Configuration="Release"`;Platform="AnyCPU" -NonInteractive -Symbols'.
1> Attempting to build package from 'Konami.Core.csproj'.
1> Packing files from 'C:\projects\Git\Konami\Konami.Core\bin\Release'.
1> Using 'Konami.Core.nuspec' for metadata.
1> Found packages.config. Using packages listed as dependencies
Jul 2, 2014 at 9:14 PM
OKOKOKOKOKOKOK :) You can totally ignore me now. I guess I just needed a day away from this so I can see it with a clear head. The answer was developmentDependency="true" in packages.config on the dependencies I didn't want included.
Marked as answer by deadlydog on 7/2/2014 at 1:17 PM