msi 安装程序运行两次
我有一个通过 msi 安装的程序。 msi 是使用 VS2008 部署项目构建的,并具有在安装完成后运行该程序的自定义操作。
一旦 msi 运行,我可以简单地更新版本号,生成新的产品代码,并且 msi 可以在同一台 PC 上再次运行。但是,我想要的是能够在同一台 PC 上第二次运行 msi(不使用 msi 修复)并再次重新安装软件(即使没有任何更改)。这可能吗?
I have an program that gets installed via an msi. The msi was built using a VS2008 deployment project and has a custom action to run the program once the install is complete.
Once the msi has been run, I can simply update the version number, generate a new product code and the msi can be run again on the same PC. However, what I want is to be able to run the msi a second time on that same PC (without using msi repair) and have it re-install the software again (even if nothing has changed). Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以通过从 InstallExecuteSequence 表中删除 RegisterProduct 操作、RegisterUser 操作、PublishProduct 操作和 PublishFeatures 操作来实现此目的。通过删除这些标准操作,应用程序将不会在系统的 MSI 数据库中注册,您可以一遍又一遍地运行和重新运行安装,就像首次安装一样。
MSDN:
添加和删除应用程序并在注册表中不留下任何痕迹
You can accomplish this by removing the RegisterProduct Action, RegisterUser Action, PublishProduct Action, and PublishFeatures Action from the InstallExecuteSequence Table. By removing these standard actions, the application will not get registered in system's MSI database and you can run and re-run the install over and over as if it were a first-time install.
MSDN:
Adding and Removing an Application and Leaving No Trace in the Registry
编辑:我读错了。
一次射击
EDIT: I read this wrong.
OneSHOT
不,这是不可能的。即使您更改了 ProductCode 和 ProductVersion,第二次运行时它将始终以修复模式运行。即使是修补方法也是实现修复模式并基本上使用修补程序文件作为转换。
实现此目的的唯一方法是以某种方式阻止应用程序进入 ARP,但我怀疑这会破坏应用程序的弹性,在这种情况下,您可能不希望使用 MSI 作为交付系统。
我过去使用纯 InstallScript 设置完成了这一点。安装完成后,我会删除与 ARP 相关的注册表项,以便再次安装时就像新安装一样。
No, this is not possible. Even if you change the ProductCode and the ProductVersion, the second time it runs it will always run in repair mode. Even the patching method is implementing the repair mode and basically using the patch file as a transform.
The only way to accomplish this would to somehow prevent any entry of the application in ARP, but I suspect that will break the resiliency of the application in which case you probably do not want to use MSI as your delivery system.
I have accomplished this in the past using a pure InstallScript setup. Once the setup has completed I remove the registry entries related to ARP so another install will act like a new install.
使用实例转换进行第二次安装
http://msdn.microsoft.com/en-us /library/aa367797(VS.85).aspx
use an instance transform for a second installation
http://msdn.microsoft.com/en-us/library/aa367797(VS.85).aspx