How can I make windows installer (WiX) always think it is running an upgrade or new install?

[亡魂溺海] 提交于 2019-12-23 05:28:05

问题


This is an installer for a SQL database. It really does not change anything on the local computer but connects to a database to make changes.

The user could be upgrading 3 different database servers from one computer so they should be able to run it 3 times utilizing the same dialogs.

I would like the installer to always show the same custom dialogs I have setup. I do not want it to go into the maintenance dialog.

I have set the MajorUpgrade tag as so, which the documentation says covers "AllowSameVersionUpgrades"

 <MajorUpgrade AllowDowngrades="yes" />

I tried changing the dialogs "Next" buttons like so. NewDBDlg is a custom screen.

 <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="NewDBDlg">1</Publish>
 <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="NewDBDlg">1</Publish> 

This kind of works but it gets to the last "VerifyReadyDlg" screen and it is mostly blank with only a "Back" and "Cancel" button.

Am I heading in the right direction or should I try something else like remove the install as part of the installation?


回答1:


Sometimes I need to make an .MSI that isn't really a traditional installer. It's more of a utility then an installed application. Microsoft does this sometimes with their Microsoft Fix it series of utilities.

This is an uncommon scenario but can be done by suppressing certain Windows Installer standard actions:

<InstallExecuteSequence>
  <RegisterProduct Suppress="yes" />
  <PublishFeatures Suppress="yes" />
  <PublishProduct Suppress="yes" />
</InstallExecuteSequence>

Because the product is never registered with the installer service there is no repair, uninstall, upgrade, maintenance and so on.




回答2:


The reason it goes into maintenance mode is because you have the same ProductCode every time, so changing the ProductCode for each build would work. But then you are filling the system with installed products. So...

If you're willing to use the MajorUpgrade element and increment the ProductVersion (and change ProductCode) for each build of the MSI, then a major upgrade shouldf work. Every install will be a complete fresh install, but if the older product happens to be there then it will uninstall it. Then you'll only ever have one antry in Program&Features. Otherwise Chris's solution is good.

This doesn't really seem like the kind of thing that Windows Installer was designed for.



来源:https://stackoverflow.com/questions/30337209/how-can-i-make-windows-installer-wix-always-think-it-is-running-an-upgrade-or

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!