2014-12-01 90 views
0

尝试如何使用NuGet将其他文件添加到包中?

Nuspec

<files> 
    <file src="https://raw.githubusercontent.com/030/chocolateyautomatic/master/common/Uninstall-ChocolateyZipPackage030.ps1" target="tools" /> 
</files> 

结果

文件不会被添加到工具目录


运行cpack表示下列内容:

Calling 'C:\ProgramData\Chocolatey\chocolateyinstall\nuget.exe pack -NoPackageAnalysis 
Attempting to build package from 'eclipse.nuspec'. 
The given path's format is not supported. 

尝试2

<files> 
    <file src="path\to\chocolateyautomatic\common\Uninstall-ChocolateyZipPackage030.ps1" target="tools\Uninstall-ChocolateyZipPackage030.ps1" /> 
    </files> 

结果两个

The given path's format is not supported.问题已经消失,但Uninstall-ChocolateyZipPackage030.ps1文件不被添加到工具目录。

+0

是你的标记标记?换句话说,整个文件看起来像什么? – Swoogan 2014-12-01 21:51:52

+0

@Sogogan https://github.com/030/chocolateyautomatic/blob/master/eclipse/eclipse.nuspec – 030 2014-12-01 22:26:47

回答

2
<files> 
    <file src="..\..\..\common\Uninstall-ChocolateyZipPackage030.ps1" target="tools\Uninstall-ChocolateyZipPackage030.ps1" /> 
    <file src="tools\*" target="tools" /> 
    </files> 

将所有文件添加到nupkg文件。

+0

你可能不想使用一个硬编码的文件路径。您应该使用文件的相对路径。这样,如果您更改存储库的checkout目录,文件包含将仍然有效。 – 2014-12-02 09:57:45

+0

@GaryEwanPark同意但这怎么可能实现?常用文件夹不驻留在eclipse文件夹中,例如工具目录。我正在检查[本文档](http://docs.nuget.org/docs/reference/nuspec-reference) – 030 2014-12-02 10:10:55

+1

我原以为你应该能够做类似于src =“.. \ .. \常见\ ...“,即相对于nuspec文件所在的位置导航文件夹,然后导航到所需的文件夹路径。 – 2014-12-02 10:59:47

相关问题