4

I can create MSI via WIX -> we installed it on IIS. What is happening - we had some version of application installed already on let's say 1.8, then we installed version let's say 99.0 just for testing purposes, then we uninstalled this 99 version. Then i tryed to install other version and obtained: A newer version of the product is already installed.

Then i tryed following changing upgrade code of product - and make high version again, then uninstall and install lower version - and it worked fine.

So i feel i missing something - additional information is that in programs and features list i cannot find that higher application after uninstall - then my question is how installer evaluate that there is newer version? where exactly are informations about what is installed(and are used for comparison) stored and how to effectively and easily access them? so i can look straight on it?

Petr Kováč
  • 365
  • 1
  • 2
  • 10
  • Not sure if it answers the core question, but adding a link to an answer which describes how to get a **full list of associated product codes, upgrade codes and product names for a given machine**: [**How can I find the Upgrade Code for an installed MSI file?**](https://stackoverflow.com/questions/46637094/how-can-i-find-the-upgrade-code-for-an-installed-msi-file/46637095#46637095). – Stein Åsmul Oct 11 '17 at 16:23

1 Answers1

6

ProductCode identifies a particular product. It changes every time you ship a new replacement product. UpgradeCode defines a series of products by using the same UpgradeCode in a updated products whose versions are expected to continually increase. By default, new product versions replace older product versions with a major upgrade. Because upgradecode defines a product series, Windows will look for products with the same UpgradeCode because identical UpgradeCodes means mutually exclusiv products, using them to replace an older product with a new one. In WiX, major upgrade is done with the majorupgrade element which it appears you may be using because you get that "a newer version is installed" message. There is an AllowDowngrade option there if you want to "upgrade" to a lower version.

Product versions (like file versions) are not just useful information - they are used by the system with the understanding that new replaces old and generally it is a bad thing to go back to lower versions, that's why the default behavior disallows downgrades.

This script might help. It uses the Windows Installer scripting API to enumerate all the installed products, showing version, user sid, ProductCode etc:

Option Explicit
Public installer, fullmsg, comp, prod, a, fso, pname, ploc, pid,contxt, sid, psorce, pcache, pvers

Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("prodex.txt", True)

' Connect to Windows Installer object
Set installer = CreateObject("WindowsInstaller.Installer")
a.writeline ("Products")
'on error resume next
For Each prod In installer.ProductsEx("", "", 7)
   pid = prod.ProductCode
   contxt = prod.Context
   sid=prod.usersid
   pname = prod.InstallProperty("ProductName")
   psorce = prod.InstallProperty("InstallSource")
   ploc =prod.InstallProperty("InstallLocation")  
   pcache = prod.InstallProperty("LocalPackage") 
   pvers=prod.InstallProperty("VersionString")
   a.writeline (pid & " " & pname & " " & pvers & " installed at <" & ploc & "> from " & psorce & " Context " & contxt & " Local " & pcache)
Next
PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • well, more or less i'm aware of what you wrote, however problem is problem -> it is being said that there is newer version according to windows. If anyone has more direct answer - where can i see some kind of table where OS windows decide if there is really newer version? in log you can see relative products - then i took product codes listed in log, deleted entries in registry, however still getting error that there is new version installed - then it isn't probably registry, where MSI decide if something is or isnt installed – Petr Kováč Mar 30 '15 at 14:08
  • thanks, we probably found solution. I messed up upgrade codes(originally they were wrong, i repaired them however) in subversion - we build from old version, were we left same upgrades code for 4 applications, so on server was installed diff. application with same upgrade code what made mess. – Petr Kováč Mar 31 '15 at 17:33
  • Note that there's a bug in line 5 that will crash the script when there's a Unicode product name - it should be: `fso.CreateTextFile("prodex.txt", True, True)`. I edited the answer to correct this, but reviewers rejected my edit for some reason... \*shrug\* – Paul Feb 07 '20 at 22:49