I am building a self-contained Chocolatey package. The package folder contains: app.nuspec
, app.exe
, app.nupkg
, and the tools
subfolder. The chocolateyInstall.ps1
is like this:
$packageName = 'app'
$fileType = 'exe'
$silentArgs = '/VERYSILENT'
$url = '../app.exe' # the location of the file relative to the tools folder
Install-ChocolateyPackage $packageName $fileType $silentArgs $url
When I run:
choco install app -y
I get:
Copy-Item : cannot find the path C:\ProgramData\app.exe because does not exist
How can I make this work? I've read a bit about 'create self-contained package with shims' but I don't really get how to use that? Any help? thank you
EDIT 1
I have found also this other solution here (http://patrickhuber.github.io/2015/03/19/creating-enterprise-versions-of-public-chocolatey-packages.html) that does work. So in my case that would be:
$directory = $PSScriptRoot
$packageName = 'app'
$fileType = 'exe'
$silentArgs = '/VERYSILENT'
$url = Join-Path $directory '..\app.exe'
Install-ChocolateyPackage $packageName $fileType $silentArgs $url
I was wondering what is the $PSScriptRoot
variable?