1
votes

I'm creating an installer for one of our products. The installer was done with WISE earlier but we wanted to change this to wix with this release. It's important that our users uninstall the old version of the product before installing the new version and thus I need to check for a key in the registry that was created by the old installer (the key is removed when the old version is uninstalled).

I have a conditional check in the wxs like so:

<!-- Check if older version of Product has been installed. Must be removed by user-->
<!-- The key below is set by the old installer. If it exists, the old version is there.-->
<Property Id="OLDKEY">
  <RegistrySearch Id="OldRegKey" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Company Product för Product" Name="DisplayName" Type="raw"></RegistrySearch>
</Property>

<Condition Message="You need to uninstall the old version of Product before installing this one.">
  OLDKEY
</Condition>

You'll notice a Swedish character in there. I suspect this might be the cause of some problems. This is how I configured since I had to handle Swedish characters:

<Product
  Id="*"
  Name="$(var.Manufacturer) $(var.ApplicationName)"
  Language="1033"
  Version="!(bind.FileVersion.Product.exe)"
  Manufacturer="$(var.Manufacturer) AB"
  UpgradeCode="[GUID]"
  Codepage="1252"
>

Notice the 1252 codepage.

When I install and have the old version on the machine, I find the key in the registry and the installer will show me the message. If I remove the old version I can see the registry key disappear but the installer will still show me the message and exit. I have tried rebooting (you never know) to no avail.

I'm running out of ideas... any thoughts?

1
What does the verbose log say? - Yan Sklyarenko
Create an install log for details. My guess is that somehow that property is set. - Ciprian
Was the Wise installer was also an MSI? (The key you quote suggests it was not.) But if it was you can probably use upgrades to find the previous. - Michael Urman
Fyi, requiring users to uninstall first is extremely annoying. Especially if it's not done automatically by the installer (without asking any questions such as "do you want to delete your settings, too" of course) which then performs the installation automatically after the uninstallation finished. - ThiefMaster
@MichaelUrman, No, it was an exe. Old legacy crap. - Phil

1 Answers

2
votes

Turns out the registry search returns 1 if key is not found. So I changed

OLDKEY

To

<![CDATA[OLDKEY <> 1]]>

And it was fixed.