11

问题

已按照网站上的说明创建了需要位于Chocolatey Gallery中的某些软件的 Chocolatey 包。如果 nuspec 文件包含依赖项:

...</tags>
    <dependencies>
      <dependency id="dependentPackageA" version="1.0"/>
      <dependency id="dependentPackageB" version="2.0"/>
    </dependencies>
  </metadata>...

cinst packageName -source ""%cd%;http://chocolatey.org/api/v2/""执行命令在本地测试 Chocolatey Package,出现如下错误:

The term 'http://chocolatey.org/api/v2/' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a 
path was included, verify that the path is correct and try again.

如果依赖片段已被注释并被cinst packageName -source %cd%执行,Chocolatey 包将在本地安装。

将 Chocolatey 包提供给Chocolatey Gallery,然后通过发出cinst packageName成功安装它(安装包和依赖项)。

问题

如何在将 Chocolatey Package 发布到Chocolatey Gallery之前在本地测试 Chocolatey Package 依赖项?

4

1 回答 1

10

在每一侧使用撇号'和双引号,例如:"

--source "'.;https://chocolatey.org/api/v2/'"

为了缩短一点,在较新版本的 Chocolatey 中,您可以尝试:

-s "'.;chocolatey'"

https://github.com/chocolatey/choco/wiki/CreatePackages#testing-your-package

将参数传递给 Chocolatey

于 2014-04-28T22:59:36.200 回答