【问题标题】:How to add additional files to a package using NuGet?如何使用 NuGet 将其他文件添加到包中?
【发布时间】:2014-12-01 21:06:35
【问题描述】:

尝试

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.

尝试两次

  <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 文件未添加到工具目录中。

【问题讨论】:

标签: nuget chocolatey


【解决方案1】:
  <files>
    <file src="..\..\..\common\Uninstall-ChocolateyZipPackage030.ps1" target="tools\Uninstall-ChocolateyZipPackage030.ps1" />
    <file src="tools\*" target="tools" />
  </files>

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

【讨论】:

  • 您可能不想使用硬编码的文件路径。您应该改为使用文件的相对路径。这样,如果您更改存储库的签出目录,文件包含仍然有效。
  • @GaryEwanPark 同意,但是如何实现呢? common 文件夹不驻留在 eclipse 文件夹中,例如 tools 目录。我正在检查this documentation
  • 我原以为您应该能够执行类似于 src="..\..\common\..." 的操作,即向上导航相对于 nuspec 文件所在位置的文件夹,然后导航到所需的文件夹路径。
  • @GaryEwanPark ..\common 不起作用,但 ..\..\..\common_output 目录中工作,现在可以找到公共文件夹。谢谢。
猜你喜欢
  • 2021-05-12
  • 2017-11-13
  • 2017-06-17
  • 2011-05-05
  • 2014-08-12
  • 1970-01-01
  • 1970-01-01
  • 2021-12-22
  • 1970-01-01
相关资源
最近更新 更多