I am trying to create a Chocolatey package and was able to "choco pack" and "choco push" to a local chocolatey.server (simple server) repository. I have configured my C:\ProgramData\Chocolatey\config\chocolatey.config
to point to my local chocolatey.server URL. When I try to run
choco install test1
I get the following error:
The package test1 wants to run 'chocolateyinstall.ps1'. Note: If you don't run this script, the installation will fail. Note: To confirm automatically next time, use '-y' or consider setting 'allowGlobalConfirmation'. Run 'choco feature -h' for more details. Do you want to run the script?([Y]es/[N]o/[P]rint): Y
ERROR: Cannot bind parameter because parameter 'file' is specified more than once. To provide multiple values to parameters that can accept multiple v alues, use the array syntax. For example, "-parameter value1,value2,value3". The install of nimatest was NOT successful. Error while running 'C:\ProgramData\chocolatey\lib\test1\tools\chocolateyinstall.ps1'. See log for details.
Chocolatey installed 0/1 packages. 1 packages failed. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures - test1 (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\test1\tools\chocolateyinstall.ps1'. See log for details.
In my test.nuspec I have the following:
<files>
<!-- This section controls what actually gets packaged into the Chocolatey package -->
<file src="tools*" target="tools" />
<!-- Building from Linux? You may need this instead: <file src="tools/*" target="tools" /> -->
</files>
In my chocolateyinstall.ps1 I have:
$ErrorActionPreference = 'Stop';
$packageName= 'Test1'
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$fileLocation = Join-Path $toolsDir 'Test1.exe'
$packageArgs = @{
packageName = $packageName
fileType = 'exe'
file = $fileLocation
silentArgs = "/SP"
validExitCodes= @(0, 3010, 1641)
softwareName = 'Test1*'
checksum = ''
checksumType = 'md5'
checksum64 = ''
checksumType64 = 'md5'
}
Install-ChocolateyPackage @packageArgs