windows 在 Inno Setup 安装中运行另一个安装程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1052717/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:43:29  来源:igfitidea点击:

Run another installer in an Inno Setup installation

windowsinno-setup

提问by Craig McQueen

My company is developing an application that has a dependency on another of our applications. That second application already has an Inno Setup installer.

我的公司正在开发一个依赖于我们的另一个应用程序的应用程序。第二个应用程序已经有一个 Inno Setup 安装程序。

So I think I'd like to bundle the second application's installer within the Inno Setup installer for the first application. But I'm not sure how to go about that properly. Does anyone know the "right way" to do this?

所以我想我想将第二个应用程序的安装程序捆绑在第一个应用程序的 Inno Setup 安装程序中。但我不知道如何正确地做到这一点。有谁知道这样做的“正确方法”吗?

I found this: Inno Setup Knowledge Base—HOWTO: Install .MSI files. I assume the technique could be used for a nested Inno Setup installer. But I have a couple of questions about the fine details:

我发现了这个:Inno Setup Knowledge Base—HOWTO: Install .MSI files。我认为该技术可用于嵌套的 Inno Setup 安装程序。但我有几个关于细节的问题:

  1. How could I make it so if the first application is uninstalled, the second is also uninstalled?
  2. Is that a sensible thing to do (automatically uninstall the second application), or should I leave it to the user to do that manually?
  3. If the user tries to uninstall the second application while the first is uninstalled, should I somehow detect that and give a warning? How could I do that?
  1. 如果第一个应用程序被卸载,我怎么能做到这一点,第二个应用程序也被卸载?
  2. 这是明智的做法(自动卸载​​第二个应用程序),还是应该让用户手动执行此操作?
  3. 如果用户在卸载第一个应用程序时尝试卸载第二个应用程序,我应该以某种方式检测到并发出警告吗?我怎么能那样做?

采纳答案by Treb

For the level of uninstaller functionality you are talking about, I suggest you get familiar with pascal scripting in Inno Setup (if you are not already). It offers incredible customisation, but has the caveat of making your projects a lot more complex.

对于您所谈论的卸载程序功能级别,我建议您熟悉 Inno Setup 中的 pascal 脚本(如果您还没有)。它提供了令人难以置信的定制,但有一个警告,使您的项目变得更加复杂。

To answer your third question first:

先回答你的第三个问题:

Yes, you should do this. In order to do it properly, you need to add this functionality to the uninstaller of the second application (i.e. the one your app is dependent on). See Uninstall event functionsin the Inno Setup help. You need to check in that uninstaller if your app is installed (by checking if HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SecondAppNameexists, for example) and in that case show an additional warning.

是的,你应该这样做。为了正确执行此操作,您需要将此功能添加到第二个应用程序(即您的应用程序所依赖的应用程序)的卸载程序中。请参阅Uninstall event functionsInno Setup 帮助。如果您的应用程序已安装(HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SecondAppName例如,通过检查是否存在),您需要检查该卸载程序,并在这种情况下显示附加警告。

As for your second question:

至于你的第二个问题:

If it is remotely possible that your customer wants to continue using the second app, even if he decides that he wants to uninstall the first one, you should offer him the choice. I would do this with a seperate wizard page in the uninstaller for your app, after your app is uninstalled.

如果您的客户希望继续使用第二个应用程序的可能性很小,即使他决定要卸载第一个应用程序,您也应该为他提供选择。卸载应用程序后,我会在应用程序的卸载程序中使用单独的向导页面执行此操作。

And finally, your first question:

最后,你的第一个问题:

You need to determine the name (full path) of the other app'suninstaller exe. You can retrieve it from the registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SecondAppName\UninstallString. For executing it from a script in the [CODE] section, see Execin the Inno Setup help.

您需要确定其他应用程序的卸载程序exe的名称(完整路径)。您可以从注册表项中检索它HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SecondAppName\UninstallString。要从 [CODE] 部分中的脚本执行它,请参阅ExecInno Setup 帮助。