7zip 自解压安装程序会在安装完成之前删除文件

发布于 2024-12-18 21:19:29 字数 820 浏览 7 评论 0原文

我们制作了一个使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笑咖 2024-12-25 21:19:29

我无法立即通过你的样本判断出它出了什么问题。不过,这是我用来构建 7z 自解压存档的方法,效果很好,仅在安装结束后才删除文件。

配置文件:

;!@Install@!UTF-8!
Title="My Installer"
InstallPath="%temp%\\Temp_Installation"
RunProgram="setup.exe"
Delete="%temp%\\Temp_Installation"
;!@InstallEnd@!

创建脚本(NAnt):

<exec program="${_7z.exe}" workingdir="${path}\SFX">
  <arg line="a -y -r ${path}\setup.7z" />
  <arg line="${paths.build.to7z}\*.*"/>
</exec>

<exec program="cmd.exe" verbose="true" workingdir="${path}\SFX">
  <arg value="/C" />
  <arg line="copy /b 7ZSD_All.sfx + ${config} + ${path}\setup.7z" />
  <arg file="${paths.build.sfx}\setup.exe"/>
</exec>

希望这可以帮助您找到问题的根源。您还可以检查您是否使用最新版本的 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:

;!@Install@!UTF-8!
Title="My Installer"
InstallPath="%temp%\\Temp_Installation"
RunProgram="setup.exe"
Delete="%temp%\\Temp_Installation"
;!@InstallEnd@!

The creation script (NAnt):

<exec program="${_7z.exe}" workingdir="${path}\SFX">
  <arg line="a -y -r ${path}\setup.7z" />
  <arg line="${paths.build.to7z}\*.*"/>
</exec>

<exec program="cmd.exe" verbose="true" workingdir="${path}\SFX">
  <arg value="/C" />
  <arg line="copy /b 7ZSD_All.sfx + ${config} + ${path}\setup.7z" />
  <arg file="${paths.build.sfx}\setup.exe"/>
</exec>

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.

国际总奸 2024-12-25 21:19:29

当我省略删除时,对我有用:

;!@Install@!UTF-8!
Title="My Installer"
InstallPath="%temp%\\Temp_Installation"
RunProgram="setup.exe"
;!@InstallEnd@!

Works for me, when i omit the Delete:

;!@Install@!UTF-8!
Title="My Installer"
InstallPath="%temp%\\Temp_Installation"
RunProgram="setup.exe"
;!@InstallEnd@!
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文