首页 > 解决方案 > 如何告诉巧克力垫片使用安装文件所在的原始网络位置的路径

问题描述

当基于本地网络上的安装程序安装本地托管的巧克力包时,我可以看到创建了一个 shim。我理解的这个垫片指向原始安装程序。但要使其正常工作,需要在网络位置运行 shim,以便安装程序可以找到其他需要的文件。我尝试使用以下方法将网络位置添加到路径中: Install-ChocolateyPath 但我没有成功。我还尝试在与网络上的原始文件相同的目录中创建一个 Setup.exe.ignore 文件,但没有成功。我已经看到了参考,--shimgen-usetargetworkingdirectory但我不知道如何实现它。任何帮助是极大的赞赏。

标签: chocolateyshim

解决方案


所以我自己想出了这个,并认为我会分享。在chocolateyinstall.ps1我使用Install-ChocolateyInstallPackage而不是Install-ChocolateyPackage解决了与路径相关的问题并在与原始安装文件相同的目录中运行垫片。

更多信息在这里:

https://chocolatey.org/docs/helpers-install-chocolatey-package

https://chocolatey.org/docs/helpers-install-chocolatey-install-package

中的评论chocolateyinstall.ps1说明了一切。

## If you are making your own internal packages (organizations), you can embed the installer or 
## put on internal file share and use the following instead (you'll need to add $file to the above)
Install-ChocolateyInstallPackage @packageArgs # https://chocolatey.org/docs/helpers-install-chocolatey-install-package

推荐阅读