Our IA project produces the Wrapper MSI for users to install. Once run (msiexec /i product_1.0.msi), there are several registry entries produced:
Code: Select all
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{PRODUCT-CODE} (DisplayVersion=1.0.0)
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{PRODUCT-CODE}
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{WRAPPER-MSI-V1-PRODUCT-CODE} (DisplayVersion=1.0.0)
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\My Product (DisplayVersion=1.0.0)
In Add/Remove Programs we see:
Name: My Product
Publisher: Us
Version: 1.0.0
All good with that, but now I run v2 (msiexec /i product_2.0.msi), which contains the code
Code: Select all
if Variable NEEDSUPGRADE Equals TRUE
Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
...
Which removes the old version, and installs the new version without issue. The only niggle now is the registry and two entries in the Add/Remove Programs:
Code: Select all
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{PRODUCT-CODE} (DisplayVersion=2.0.0)
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{PRODUCT-CODE}
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{WRAPPER-MSI-V1-PRODUCT-CODE} (DisplayVersion=1.0.0)
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{WRAPPER-MSI-V2-PRODUCT-CODE} (DisplayVersion=2.0.0)
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\My Product (DisplayVersion=2.0.0)
Add/Remove Programs:
Name: My Product
Publisher: Us
Version: 1.0.0
Name: My Product
Publisher: Us
Version: 2.0.0
It seems there is no way of getting hold of the MSI wrapper product code without implementing some kind of registry search for old versions as part of the remove old code. I had the idea that I can interrogate the created MSI and find its product ID, then modify it to pass that value to the real setup and then store that value in the registry. I can then use that value as part of the remove old code.
Before I go implementing all kind of things to find the MSI product code, is there a better solution?