问题描述
我有一个用电子工具构建的应用程序,但是,当我尝试将该应用程序安装在未安装运行该应用程序所必需的.net Framework或msbuild的其他计算机上时,它不起作用。那么,有没有一种方法可以在安装过程中安装依赖项?
解决方法
在您的项目中添加目录“软件”,以在其中放置可执行文件。
并且可以在package.json中定义“构建”对象“ extraFiles”,以将其放入打包的应用中。
之后,您可以在nsis区域中定义安装时应执行的脚本。
这是一个例子:
"build": {
"win": {...},"nsis": {
// other config stuff,"include": "installer.sh"
},"extraFiles": [
"software"
]
}
在installer.sh
中,您可以定义一个customInstall
宏并执行可执行文件
例如:
!macro customInstall
Exec 'cmd command to install executable'
// or
ExecWait 'cmd command to install executable'
// if you need a powershell:
ExecWait 'Powershell -windowstyle hidden -Command "powershell command"'
// to get the install path of your app
// you can use the global variable $INSTDIR
!macroEnd
请确保您在安装时具有所需的权限