handle "Another version of this product is already installed. Installation of this version cannot continue..."

Nothing 2 Lose picture Nothing 2 Lose · Mar 5, 2013 · Viewed 42.3k times · Source

I have 32-bit and 64-bit versions of my installer which have (nearly) the exact same code & custom action sequence (there are only minor differences which are not relevant to this issue)

I want my installer to detect whether it has already been previously installed and in this case run my own code instead of showing the default Windows Installer error:

Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.

My 32-bit installer works perfectly fine in that it runs my custom code if I run the installer when the product is already installed, but the same code & custom action in my 64-bit installer does NOT work correctly and always shows the unwanted error msg.

CheckPreviousVersion is the first function called as a Custom Action during the UI sequence, I've tried putting it in different spots like after InstallValidate but nothing works.

I've examined the verbose log file but I can't find anything that might explain this behavior, here is a part of the log:

=== Verbose logging started: 05/03/2013  16:27:20  Build type: SHIP UNICODE 5.00.7601.00  Calling process: C:\Windows\system32\msiexec.exe
===

MSI (c) (0C:94) [16:27:20:331]: Machine policy value 'Debug' is 0 MSI (c) (0C:94) [16:27:20:331]: ******* RunEngine:
           ******* Product: foo.msi
           ******* Action: 
           ******* CommandLine: ********** MSI (c) (0C:94) [16:27:21:546]: Machine policy value 'DisableUserInstalls' is 0 MSI (c) (0C:94) [16:27:21:557]: SOFTWARE RESTRICTION POLICY: Verifying package --> 'C:\Builds\.msi' against software restriction policy MSI (c) (0C:94) [16:27:21:557]: Note: 1: 2262 2: DigitalSignature 3:
-2147287038  MSI (c) (0C:94) [16:27:21:557]: SOFTWARE RESTRICTION POLICY: C:\Builds\.msi is not digitally signed MSI (c) (0C:94) [16:27:21:558]: SOFTWARE RESTRICTION POLICY: C:\Builds.msi is permitted to run at the 'unrestricted' authorization level. MSI (c) (0C:94) [16:27:21:584]: Cloaking enabled. MSI (c) (0C:94) [16:27:21:584]: Attempting to enable all disabled privileges before calling Install on Server MSI (c) (0C:94) [16:27:21:586]: End dialog not enabled MSI (c) (0C:94) [16:27:21:586]: Original package ==> C:\Builds\....msi MSI (c) (0C:94) [16:27:21:586]: Package we're running from ==> C:\Builds\.....msi MSI (c) (0C:94) [16:27:21:589]: APPCOMPAT: Uninstall Flags override found. MSI (c) (0C:94) [16:27:21:589]: APPCOMPAT: Uninstall VersionNT override found. MSI (c) (0C:94) [16:27:21:589]: APPCOMPAT: Uninstall ServicePackLevel override found. MSI (c) (0C:94) [16:27:21:589]: APPCOMPAT: looking for appcompat database entry with ProductCode '{B8CBA92E-2140-48AB-B4EA-A4C3FF10295B}'. MSI (c) (0C:94) [16:27:21:589]: APPCOMPAT: no matching ProductCode found in database. MSI (c) (0C:94) [16:27:21:599]: MSCOREE not loaded loading copy from system32 MSI (c) (0C:94) [16:27:21:608]: Machine policy value 'DisablePatch' is 0 MSI (c) (0C:94) [16:27:21:608]: Machine policy value 'AllowLockdownPatch' is 0 MSI (c) (0C:94) [16:27:21:608]: Machine policy value 'DisableLUAPatching' is 0 MSI (c) (0C:94) [16:27:21:608]: Machine policy value 'DisableFlyWeightPatching' is 0 MSI (c) (0C:94) [16:27:21:609]: APPCOMPAT: looking for appcompat database entry with ProductCode '{}'. MSI (c) (0C:94) [16:27:21:609]: APPCOMPAT: no matching ProductCode found in database. MSI (c) (0C:94) [16:27:21:609]: Transforms are not secure. MSI (c) (0C:94) [16:27:21:609]: PROPERTY CHANGE: Adding MsiLogFileLocation property. Its value is 'C:\Builds\Angoss\Products\Workstation\single-exec\INSTALL64.LOG'. MSI (c) (0C:94) [16:27:21:609]: Command Line: CURRENTDIRECTORY=C:\Builds\Angoss\Products\Workstation\single-exec CLIENTUILEVEL=0 CLIENTPROCESSID=7948  MSI (c) (0C:94) [16:27:21:609]: PROPERTY CHANGE: Adding PackageCode property. Its value is '{}'. MSI (c) (0C:94) [16:27:21:609]: Product Code passed to Engine.Initialize:  '' MSI (c) (0C:94) [16:27:21:609]: Product Code from property table before transforms: '{}' MSI (c) (0C:94) [16:27:21:609]: Product Code from property table after transforms:  '{}' MSI (c) (0C:94) [16:27:21:609]: Product registered: entering maintenance mode MSI (c) (0C:94) [16:27:21:609]: Determined that existing product (either this product or the product being upgraded with a patch) is installed per-machine. MSI (c) (0C:94) [16:27:21:609]: PROPERTY CHANGE: Adding ProductState property. Its value is '5'. MSI (c) (0C:94) [16:27:21:609]: PROPERTY CHANGE: Adding ProductToBeRegistered property. Its value is '1'. MSI (c) (0C:94) [16:27:21:609]: Entering CMsiConfigurationManager::SetLastUsedSource. MSI (c) (0C:94) [16:27:21:609]: Specifed source is already in a list. MSI (c) (0C:94) [16:27:21:609]: User policy value 'SearchOrder' is 'nmu' MSI (c) (0C:94) [16:27:21:609]: Machine policy value 'DisableBrowse' is 0 MSI (c) (0C:94) [16:27:21:609]: Machine policy value 'AllowLockdownBrowse' is 0 MSI (c) (0C:94) [16:27:21:609]: Adding new sources is allowed. MSI (c) (0C:94) [16:27:21:609]: PROPERTY CHANGE: Adding PackagecodeChanging property. Its value is '1'. Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.

Answer

Bogdan Mitrache picture Bogdan Mitrache · Mar 6, 2013

This message usually appears only during development phases, not on the end-user machine. The message appears because you modify only the resources from the package and rebuild it, without increasing the version number, so Windows Installer sees there is a package with the same product code and name on the machine, but with a different package code.

Your users will never get this message because I assume you will increase the version number when releasing the package. This is also based on the name of your function i.e. "CheckPreviousVersion".

If you want a custom message to appear if you found an older version on the machine make sure you first have the old version installed, you currently have the latest version installed, but using another previously built package (i.e. different package code).