7zip 自解压安装程序会在安装完成之前删除文件
我们制作了一个使用 Visual Studio 和 WIX 运行良好的新安装程序。现在我正在尝试将其压缩并制作一个自解压安装程序以供分发。
我可以很好地创建 installer.exe,并且它可以运行。安装程序启动,但失败。
我认为这是因为 7zip exe 在安装程序有机会使用它们之前删除了这些文件(我们正在运行 setup.exe 来启动安装程序)。
我已经到处搜索,但找不到任何关于如何使这项工作起作用的提示。我是否缺少 7zip 选项?
创建行:
7z a myInstaller.7z installer/bin/release/*
copy /b \program files\7-zip\7zsd.sfx config.txt myInstaller.exe
Config.txt
;!@Install@!UTF-8!
Title="My Title"
RunProgram="Setup.exe"
;!@InstallEnd@!
上有一个解决方法 http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/3731985c-d9cc-4403-ab7d-992a0971f686(菲利斯大约下降了7/8) ,但这看起来很嘎吱作响。这真的是实现这项工作的唯一方法吗?
We made a new installer that works pretty well using Visual Studio and WIX. Now I'm trying to zip it up and make a self extracting installer for distribution.
I can create the installer.exe just fine, and it runs. The installer starts, but it fails.
I think this is because the 7zip exe is deleting the files before the installer has a chance to use them (we are running setup.exe to start the installer).
I have searched all over, but can't find any hints about how to make this work. Am I missing an option for 7zip?
The creation line:
7z a myInstaller.7z installer/bin/release/*
copy /b \program files\7-zip\7zsd.sfx config.txt myInstaller.exe
Config.txt is
;!@Install@!UTF-8!
Title="My Title"
RunProgram="Setup.exe"
;!@InstallEnd@!
There is a workaround on http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/3731985c-d9cc-4403-ab7d-992a0971f686 (about 7/8 down by Phylliss), but that seems creaky. Is that really the only way to make this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我无法立即通过你的样本判断出它出了什么问题。不过,这是我用来构建 7z 自解压存档的方法,效果很好,仅在安装结束后才删除文件。
配置文件:
创建脚本(NAnt):
希望这可以帮助您找到问题的根源。您还可以检查您是否使用最新版本的 7z SFX 模块。
I can't tell immediately by your sample what's wrong with it. However, here's what I used to build 7z self-extracting archive and it worked well, deleting the files only after the installation is over.
The config file:
The creation script (NAnt):
Hope this helps you finding the source of your problem. You might also check that you use the most recent version of 7z SFX module.
当我省略删除时,对我有用:
Works for me, when i omit the Delete: