Brian White
Brian White

Reputation: 8756

Overwrite MSI DisplayVersion with Custom String

I have a .msi installer (via wix) for an application I'm working on but the application's version number doesn't fit the X.Y.Z version numbers required my MSI's registry Version so the version number is "mangled" into something that does fit and still increases with every release.

I'm okay with this.

msiexec, as part of it's final cleanup, converts this X.Y.Z integer-encoded version number into a string and dumps it into the DisplayVersion registry entry. What I'd like to do is overwrite that string with my own that contains the actual version number of my application.

This certainly seems possible. For example...

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\19BF4688EE4961F41A44D0282A2340D9\InstallProperties
  DisplayName = (REG_SZ) "Configuration Manager Client"
  LocalPackage = (REG_SZ) "C:\Windows\Installer\41202.msi"
  DisplayVersion = (REG_SZ) "5.00.7958.1000"
  Version = (REG_DWORD) 0x05001f16

The Version is the encoded value of "5.00.7958", so where did the rest of the DisplayVersion string come from?

How, using only wix/msi supported options, do I overwrite DisplayVersion in the registry with my own custom string?

Upvotes: 2

Views: 724

Answers (2)

Brian White
Brian White

Reputation: 8756

I eventually accomplished this by having the MSI launch a custom installer binary near the end of the installation procedure. That program forks a background copy of itself and exits so that the install can finish.

The background task sleeps for a while to let the installation complete and then directly alters the registry to set DisplayVersion to the desired string.

There's a race condition here but it hasn't been a problem and updating the string isn't essential.

Upvotes: 0

jbudreau
jbudreau

Reputation: 1307

Might be a larger change than what you're looking to make, but...

if you set ARPSYSTEMCOMPONENT=1 in your MSI it won't register an ARP entry for your product. Then you can create your own ARP entry for your product by populating the HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\[ProductCode] keys in the Registry table of your MSI.

Upvotes: 1

Related Questions