我正在尝试创建一个自定义巧克力软件包,该软件包将使用文件共享中的MSI文件,并且我在下面收到错误。在此过程中,我可以解决大多数错误的问题,但是我无法弄清楚。
有人知道如何解决这个问题或知道我可以做什么来调试问题?
错误
ERROR: A null key is not allowed in a hash literal.
The install of ciscojabbertest2 was NOT successful.
Error while running 'C:ProgramDatachocolateylibciscojabbertest2toolschocolateyinstall.ps1'.
以下是我的nuspec文件和我的巧克力yinstall.ps1文件的副本。
ciscojabbertest2.nuspec
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>ciscojabbertest2</id>
<version>11.9.1.55716</version>
<title>ciscojabbertest2</title>
<authors>Cisco Systems, Inc</authors>
<tags>Installer_MSI_Database</tags>
<summary>Cisco Jabber</summary>
<description>Cisco Jabber</description>
</metadata>
<files>
<file src="tools**" target="tools" />
</files>
</package>
巧克力yinstall.ps1
$ErrorActionPreference = 'Stop';
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$fileLocation = '\WIN-5LEH3K6JCM3Software_TestCiscoJabberSetup.msi'
$packageArgs = @{
packageName = $env:ChocolateyPackageName
unzipLocation = $toolsDir
fileType = 'MSI'
$file = $fileLocation
softwareName = 'Cisco Jabber*'
checksum = 'A027601E0975339286EEECF593D83FF71FA64902B46A8F10F93B5E63663A215F'
checksumType = 'sha256'
silentArgs = "/quiet CLEAR=1"
validExitCodes= @(0, 3010, 1641)
}
Install-ChocolateyInstallPackage @packageArgs
我怀疑您看到的错误是由于未定义的变量$file
造成的。结果,您正在获得没有任何价值的哈希文字中的钥匙。
将其更改为以下:
$ErrorActionPreference = 'Stop';
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$fileLocation = '\WIN-5LEH3K6JCM3Software_TestCiscoJabberSetup.msi'
$packageArgs = @{
packageName = $env:ChocolateyPackageName
unzipLocation = $toolsDir
fileType = 'MSI'
file = $fileLocation
softwareName = 'Cisco Jabber*'
checksum = 'A027601E0975339286EEECF593D83FF71FA64902B46A8F10F93B5E63663A215F'
checksumType = 'sha256'
silentArgs = "/quiet CLEAR=1"
validExitCodes = @(0, 3010, 1641)
}
Install-ChocolateyInstallPackage @packageArgs