kudlatiger
kudlatiger

Reputation: 3278

Wix installer upgrade with same "upgrade code" ID shows privilege error prompt

I have developed the windows service and created the MSI installer using Wix toolset, then distributed to users. it is working as expected. Let's name this msi as version 1.0.0.0

Now, it's time to deliver a new build with service enhancements. Hence, I have created a new msi. Let's name it version 2.0.0.0 . I was hoping that the execution of new msi shall upgrade the existing application.

But I get below error, basically, it's unable to start the service

enter image description here

Here is the code from 1.0.0.0

  <?define UpgradeCode = "{3D197FE4-86DF-31FD-A0CD-21B5D3B97ABC}" ?>
  <Product Id="$(var.ProductCode)" 
       Name="!(loc.ProductName_$(var.Platform)) $(var.ProductVersion)"
       Language="!(loc.Language)" 
       Version="$(var.BuildVersion)"
       Manufacturer="!(loc.Company)" 
       UpgradeCode="$(var.UpgradeCode)">

Here is the code from 2.0.0.0

  <?define UpgradeCode = "{3D197FE4-86DF-31FD-A0CD-21B5D3B97ABC}" ?>
  <Product Id="$(var.ProductCode)" 
       Name="!(loc.ProductName_$(var.Platform)) $(var.ProductVersion)"
       Language="!(loc.Language)" 
       Version="$(var.BuildVersion)"
       Manufacturer="!(loc.Company)" 
       UpgradeCode="$(var.UpgradeCode)">

        <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" 
Schedule="afterInstallInitialize"/>

If you observe, I kept the upgradecode same as 1.0.0.0. As per https://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html

If I change the upgradecode GUID then I do not see any issues. Installation works fine. But changing the upgradecode guid will not remove the old build during upgrade. I mean, i see both 1.0.0.0 and 2.0.0.0 in control panel.It's installing one more version side by side :(

How can I come out from this issue?

Upvotes: 1

Views: 919

Answers (1)

Stein &#197;smul
Stein &#197;smul

Reputation: 42136

Configuration Issue: OK, now that I think I have read this properly I think you have a basic service configuration issue that prevents start of the service. The upgrade process probably removes something it shouldn't or it leaves the configuration files in an inconsistent state.

In other words: Something is likely wrong in the service configuration files after upgrade scenarios - or something is missing - in the selection of files or registry entries.

Most Likely: I think your service binary just isn't the right version after upgrade. Check the version number after upgrade. I bet you will find the version 1 service binary.

Tests: There are a few tests I would try:

  • Logging: First I would follow the suggestions here: https://www.coretechnologies.com/WindowsServices/FAQ.html#DiagnoseProblems
  • Folder Diff: If the above revealed nothing, try using a clean virtual to install the first version and then run the upgrade. Copy the installation folder somewhere - now revert virtual and install version two directly (without version 1 first). If the service starts now after version 2 is installed, diff the resulting folders using a diff tool of caliber such as Beyond Compare.
  • Early REP: If you haven't already - you can try to move RemoveExistingProducts early in the InstallExecuteSequence. This is just to test whether that works or not - it is not intended as a permanent fix. The idea is that the complete removal of the old version before installing the new one could remove the inconsistency you otherwise see in the configuration files.

The check-lists here could spark some ideas:

Upvotes: 2

Related Questions