【问题标题】:Creating your own packages using Chocolatey使用 Chocolatey 创建自己的包
【发布时间】:2013-12-23 14:28:52
【问题描述】:

我正在尝试使用 Chocolatey 为名为 Listary 的应用程序创建一个包。我已按照Chocolatey wiki 和文章here 上的说明进行操作。

我还在http://chocolatey.org 上创建了一个帐户并使用

nuget setApiKey -Source http://chocolatey.org/api/v2/

其中 &ltapiKey> 替换为您的 API 密钥。

当我输入命令choco pack 创建NuGet 包时,它说成功创建包,但是当我测试我刚刚使用cinst Listary -source Listary 创建的包时。 1.0.nupkg -force 它说

Invalid URI: The format of the URI could not be determined.

Command 'install' failed (sometimes this indicates a partial failure). Additional info/packages: Listary

这就是我的 Listary.nuspec 文件中的内容。

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    <id>Listary</id>
    <title>Listary</title>
    <version>1.0</version>
    <authors>Zhenheng Dai</authors>
    <owners>Zhenheng Dai</owners>
    <summary>Keep files at your fingertips. Listary is a unique search utility for Windows.</summary>
    <description>Listary is a unique search utility for Windows. Not only does it make file browsing truly flexible -- thanks to its multi-file managers support -- but the ultra-compact UI also redefines minimalism. The lightweight design doesn't stop it from providing various advanced features however, that may fit the needs of both casual and power users alike. All you have to do is just type the file name that you’re looking for, and Listary will display the search results at breakneck speed.</description>
    <projectUrl>http://www.listary.com</projectUrl>
    <tags>listary search find filemanager admin</tags>
    <copyright></copyright>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <releaseNotes></releaseNotes>
  </metadata>
  <files>
    <file src="tools\**" target="tools" />
  </files>
</package>

chocolateyInstall.ps1 包含以下内容。

$packageName = 'Listary'
$installerType = 'exe'
$url = 'http://www.listary.com/download/Listary.exe'
$silentArgs = '/SP /VERYSILENT /NORESTART'
Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url"

【问题讨论】:

  • choco 0.9.9+ 中的 API 密钥设置为 choco apikey,根本不再使用 nuget 配置。

标签: windows nuget package-managers chocolatey


【解决方案1】:

https://github.com/chocolatey/choco/wiki/CreatePackages#testing-your-package (固定链接)

请注意,源不是 nupkg,而是找到 nupkg 文件的目录。

在 choco.exe(Chocolatey 的转世)中,您可以简单地指向 nuspec 或 nupkg 文件进行安装。

【讨论】:

  • 当我在 nupkg 包所在的目录中运行命令cinst Listary -source %cd% -force 时,我得到Unable to find package 'Listary'.
  • 由于包所在的完整路径包含空格,我需要用引号将其括起来,所以我需要运行命令cinst Listary -source "%cd%" -force。我已经成功上传了你可以在chocolatey.org/packages/listary找到的包
  • 是的,使用引号也会有所帮助! :)
  • 我遇到了类似的问题,我需要将包标题放在引号中,因为标题有空格。
  • 使用 -s . \ --source . - 适用于 cmd.exe 和 powershell.exe。
猜你喜欢
  • 2022-09-30
  • 2012-09-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多