【发布时间】:2017-08-25 11:03:33
【问题描述】:
我有一个包含很多插件和配置文件的项目。现在我正在为它做一个 Visual Studio 安装项目。
我不想手动将每个配置文件添加到安装项目中,所以我想这样做:
- 创建一个空的 zip 文件,例如 config.zip,并将其添加到安装项目中
- 添加预构建操作以将所有配置文件压缩到 config.zip 中
- 添加运行 vbs 脚本的自定义操作,该脚本将 config.zip 解压缩到正确的文件夹并将其删除。
vbs 脚本如下:
sArchiveName = "Config.zip"
sLocation = "C:\Data\Configurations"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("Wscript.Shell")
oShell.Run """" & s7zLocation & "7z.exe"" x " & sLocation & "\" & sArchiveName & " -aoa -o" & sLocation, 1, True
'--- If I uncomment the following 2 lines,
'--- as I click on the shortcuts the installation rollbacks.
'--- If I leave them the shortcuts work fine.
'Set f = oFSO.GetFile(sLocation & "\" & sArchiveName)
'f.Delete True
我的问题是我在程序菜单中添加的快捷方式会导致安装回滚。原因是在安装过程结束时删除了 config.zip。如果我离开它一切正常。
我在谷歌上搜索了一个解决方案,但找不到任何东西,有人可以帮助我吗?
【问题讨论】:
标签: visual-studio installation setup-project