I use Nuget to create packages. I would like to create a package that does not contain any dependencies (in the .nuspec file) for any other NuGet packages. My project has NuGet dependencies defined in the packages.config file.
First I create a .nuspec file ...
C:\code\MySolution>.nuget\nuget.exe spec MyProject\MyProject.csproj
I am editing the generated .nuspec file minimal, without 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 create a solution and create a NuGet package ...
C:\code\MySolution>.nuget\nuget.exe pack MyProject\MyProject.csproj -Verbosity detailed
Here is the result of this 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 created .nupkg package contains the .nupkg file contained in it, but includes a dependency section that I did not have in the source .nuspec file ...
<dependencies> <dependency id="Google.ProtocolBuffers" version="2.4.1.473" /> </dependencies>
I believe this is due to this ... (from the above)
Found packages.config. Using packages listed as dependencies
How can I make NuGet not automatically resolve dependencies and embed them in the .nuspec file generated by the pack command?
I am currently using NuGet 2.2. Also, I don't think that this behavior occurred in an older version of NuGet; is this a new "feature"? I could not find the documentation describing this "function" or when it was implemented.
package dependencies nuget nuget-package nuspec
Jesse Webb Feb 21 '13 at 21:53 2013-02-21 21:53
source share