我有一个用electronic构建的应用程序,但是,当我试图在其他没有安装.net framework或msbuild的计算机上安装该应用程序时,它无法运行。那么,有没有办法在安装过程中安装这些依赖项?
在项目中添加一个目录"software",将可执行文件安装在该目录中
在您的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
确保在安装时拥有所需的权限