我正在使用 Nuget 创建包。我想创建一个包,它不包含.nuspec
任何其他 NuGet 包的任何依赖项(在 )文件中。我的项目确实在其packages.config
文件中定义了 NuGet 包依赖项。
首先我创建.nuspec
文件...
C:\code\MySolution>.nuget\nuget.exe spec MyProject\MyProject.csproj
我将生成的.nuspec
文件编辑为最小,没有依赖关系。
<?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>
然后我构建解决方案并创建一个 NuGet 包......
C:\code\MySolution>.nuget\nuget.exe pack MyProject\MyProject.csproj -Verbosity detailed
这是该命令的输出...
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'.
创建的.nupkg
包中包含一个.nuspec
文件,但它包含一个我在原始文件中没有的依赖项部分.nuspec
......
<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.