Vagrant Install-ChocolateyInstallPackage: $File parameter not recognized

Viewed 443

I am creating my own chocolatey package and I am using Install-ChocolateyInstallPackge for software installation. According to its documentation, this function takes a HashTable to pass arguments to its parameters. I have the following ones:

 #File:  chocolateyInstall.ps1
 $ErrorActionPreference="stop"
 $toolsDir = $(Split-Path -parent $MyInvocation.MyCommand.Definition)
 $installFile = Join-Path $toolsDir "jdk8u211windowsx64.exe" # JDK.exe is in parent
 ....
 $packageArgs = @{
    PackageName    = 'jdk8da'
    FileType       = 'exe'
    SoftwareName   = 'JDK8*'
    File           = $installFile
    SilentArgs     = '/s ADDLOCAL="ToolsFeature" INSTALLDIR=C:\JAVA'
    ValidExitCodes = @(0)
 }

 Install-ChocolateyInstallPackage $packageArgs

 .... #Setting Environment Variables....

However, I am getting an error:

ERROR: Package parameters incorrect, either File or File64 must be specified

As it can be seen that I have clearly specified the exe file with fill path.

It works if I specify the File parameter direct to the function:

Install-ChocolateyInstallPackage -PackageName "JDK8" -FileType "exe" -File $installFile ....

Where am I missing, can anyone point that out please?

1 Answers
Related