1
votes

After testing many of install/uninstall of my product in the machine I've ended up a scenario where I don't have my product installed, at least I cannot see it in the control panel, but when I try to install it again, Wix is trying to Update a product which is not installed.

I've executed the msi with the logs, then I found that FindRelatedProducts is found a GUID and populating the WIX property WIX_UPGRADE_DETECTED.

part of the log:

FindRelatedProducts: Found application: {MY-GUID}
MSI (c) (24:8C) [07:21:36:885]: PROPERTY CHANGE: Adding WIX_UPGRADE_DETECTED property. Its value is '{MY-GUID}'.

As I'm using WIX_UPGRADE_DETECTED to select with dialog (Install or Upgrade) to show, It's showing a upgrade dialog, but no product is installed.

If I test in another machine, doing the same scenario, FindRelatedProducts doesn't find any product, which is the correct case.

I'm suspecting of some entry in the windows Registry(regedit) was not cleaned. Do you know how Wix detects FindRelatedProducts? Or why Wix is populating the WIX_UPGRADE_DETECTED with no product installed?

Thanks!

4

4 Answers

3
votes

The Windows Installer has registration spread about the registry. It provides an API to introspect over that registration. In this case, you want ::MsiEnumRelatedProducts(). It will get you all the products related via that UpgradeCode.

You can then uninstall those products by doing:

msiexec /x {PRODUCT-CODE-GUID}

You should find {PRODUCT-CODE-GUID} is the same as what you redacted as {MY-GUID}.

Note: this has nothing to do with the WiX Toolset. Is 100% Windows Installer behavior (aka: MSI).

3
votes

Short Answer: The answer below is probably too elaborate, just do an uninstall of what your upgrade setup finds and then try to install again.

From a command prompt (Windows Key + Tap R + Type: cmd.exe + Enter) run the following command:

msiexec.exe /x {GUID-FROM-LOG-FILE}

The GUID is (most likely) the one from your log file: WIX_UPGRADE_DETECTED. Then try installing again.

Failing Uninstall: If the uninstall fails, try running this Microsoft FixIt tool. Sometimes it can sort out setups that don't uninstall properly. Alternative, under the hood fix (not recommended).


UpgradeTable: The first thing I would do is to verify what is in the UpgradeTable in the compiled MSI file that shows the problem. Does the upgrade code there match the upgrade code for your setup? (UpgradeCode entry in the Property Table).

The content of the UpgradeTable determines what existing installations (if any) are detected as related to your new installation. If you configure weird stuff here you could even end up uninstalling competitive products erroneously detected as related to yours - I wouldn't try that :-). Too much paperwork.


Uninstall: Now, how to get rid of the problem installation? You need to get hold of the ProductCode GUID. There are numerous ways to obtain this information. It should be the product GUID you see in your MSI log for WIX_UPGRADE_DETECTED, so try that first:

msiexec.exe /x {GUID}

Here is an answer on uninstalling MSI setups in a general sense (all kinds of different options - have a quick read?): Uninstalling an MSI file from the command line without using msiexec.


ProductCode (GUID): Rob has already mentioned the right MSI API to list installed products, I will just add that I have this answer here that can help: How can I find the product GUID of an installed MSI setup? It lists several options to see what is installed on your box.

VBScript / COM Automation: I will just inline the VBScript option from the first link above (there are several options listed in that linked answer):

' Retrieve all ProductCodes (with ProductName and ProductVersion)
Set fso = CreateObject("Scripting.FileSystemObject")
Set output = fso.CreateTextFile("msiinfo.csv", True, True)
Set installer = CreateObject("WindowsInstaller.Installer")

On Error Resume Next ' we ignore all errors

For Each product In installer.ProductsEx("", "", 7)
   productcode = product.ProductCode
   name = product.InstallProperty("ProductName")
   version=product.InstallProperty("VersionString")
   output.writeline (productcode & ", " & name & ", " & version)
Next

output.Close

PowerShell: Throwing in the PowerShell option as well. In some cases this can trigger unexpected self-repair.

get-wmiobject Win32_Product | Format-Table IdentifyingNumber, Name, LocalPackage -AutoSize
0
votes

FindRelatedProducts is executed by Windows Installer not WiX. Your assertion that the behavior is incorrect is most certainly incorrect. You have a dirty machine and MSI has artifacts indicating that it's installed. Your other machine is clean and does not.

0
votes

I was able to identify what were the registry entries left on the machine which was causing the errors that I mentioned.

They are in the following location:

 - HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\UpgradeCodes\{OTHER-GUID}
 - HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\{OTHER-GUID}

Note that, the {OTHER-GUID} is not my product code, but a generated one, my product code is one of a values present into those registry entries.

Just removing them makes my installer working again.

Tks @stein-Åsmul this command: get-wmiobject Win32_Product is very helpful.