定制“修复” 和“卸载” MSI 安装程序的功能(从控制面板调用时)
添加/删除程序(或程序和功能)控制面板小程序通常允许卸载或修复程序。
对于非 MSI 安装,可以轻松定义当用户单击“更改”或“卸载”按钮时应发生的情况。 只需在注册表 (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
) 中设置相应的键即可。
我的问题是,如果使用 MSI 安装,如何使“更改”、“修复”和“卸载”按钮按我的方式工作(例如启动自定义程序)?
The Add/Remove Programs (or Programs and Features) Control Panel applet usually allows to uninstall or repair a program.
For a non-MSI installation it's easy to define what should happen, when a user clicks the "Change" or "Uninstall" button. Just set the appropriate keys in the Registry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<AppName>
).
My question is how to make the "Change", "Repair", and "Uninstall" buttons to work my way (e.g. to start a custom program) if an MSI-installation is used?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 MSI,请按照 MSI 方式进行操作。
如果您想做一些不同的事情,那么就不要使用 MSI。 您会给自己带来很多很多的麻烦,并且首先失去使用 MSI 的好处。
如果您需要在卸载过程中运行自己的 EXE,请参阅我对这个问题的回答只是简单地否定了条件。
对于 MSI 安装,您必须记住的一件事是用户界面是可选的,您不能指望它在安装或卸载期间显示。 用户可能会使用
MSIEXEC /X
删除应用程序,而不是单击 ARP 中的按钮。如果您确实想“按自己的方式操作”,那么我建议为 MSI 创建一个引导程序,让 MSI安装在“添加/删除程序”中隐藏自身,并且然后使用您在上面指定的注册表项手动为您的自定义安装程序添加 ARP 条目。
If you're using an MSI, do it the MSI way.
If you want to do something different, then don't use an MSI. You'll give yourself many, many headaches and lose the benefits of using MSI in the first place.
If you need to run your own EXE during uninstall, see my answer to this question and simply just negate the conditions.
One thing you have to remember with an MSI installation is that the user interface is optional, you can't count on it being displayed either during install or uninstall. A user might remove an application with
MSIEXEC /X
rather than clicking a button in ARPIf you really want to "do it your way" then I'd suggest creating a bootstrapper for the MSI, having the MSI install hide itself from Add/Remove Programs, and then manually add an ARP entry for your custom installer using the registry keys you have specified above.
用 MSI 的话说,这将启动自定义操作(可以是 .EXE)。 Windows 安装程序有一个相当陡峭的学习曲线...并且通常试图让它“按照我的方式工作”是避免很多挫败感的捷径。
如果您打算走这条路,您应该查看 Wix.sourceforge.net。 它有一个非常活跃的用户社区,对 Windows 安装程序有深入的了解。
In MSI parlance that would be kicking off of a custom action (which can be a .EXE). Windows installer has a pretty steep learning curve... and generally trying to make it "work my way" is a short cut to lots of frustration.
If you're headed down this route you should look into Wix.sourceforge.net. Its got a very active user community that is deeply knowledgeable about windows installer.