I am using Nuget to create packages. I would like to create a package which does not contain any dependencies (in the .nuspec
) file to any other NuGet packages. My project does have NuGet package dependencies defined in its packages.config
file.
First I create the .nuspec
file...
C:\code\MySolution>.nuget\nuget.exe spec MyProject\MyProject.csproj
I edit the generated .nuspec
file to be minimal, with no dependencies.
<?xml version="1.0"?>
<package >
<metadata>
<id>MyProject</id>
<version>1.2.3</version>
<title>MyProject</title>
<authors>Example</authors>
<owners>Example</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Example</description>
<copyright>Copyright 2013 Example</copyright>
<tags>example</tags>
<dependencies />
</metadata>
</package>
Then I build the solution and create a NuGet package...
C:\code\MySolution>.nuget\nuget.exe pack MyProject\MyProject.csproj -Verbosity detailed
Here is the output of that command...
Attempting to build package from 'MyProject.csproj'.
Packing files from 'C:\code\MySolution\MyProject\bin\Debug'.
Using 'MyProject.nuspec' for metadata.
Found packages.config. Using packages listed as dependencies
Id: MyProject
Version: 1.2.3
Authors: Example
Description: Example
Tags: example
Dependencies: Google.ProtocolBuffers (= 2.4.1.473)
Added file 'lib\net40\MyProject.dll'.
Successfully created package 'C:\code\MySolution\MyProject.1.2.3.nupkg'.
The .nupkg
package that is created has a .nuspec
file contained within it but it includes a dependencies section which I did not have in the original .nuspec
file...
<dependencies>
<dependency id="Google.ProtocolBuffers" version="2.4.1.473" />
</dependencies>
I believe this is happening because of this... (from the output above)
Found packages.config. Using packages listed as dependencies
How can I make NuGet not automatically resolve dependencies and insert them into the .nuspec
file which is generated from the pack
command?
I am using NuGet 2.2 currently. Also, I don't think that this behaviour happened in older version of NuGet; is this a new "feature"? I couldn't find any documentation describing this "feature" or when it was implemented.