1

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?

Pavel Anikhouski
  • 21,776
  • 12
  • 51
  • 66
kudlatiger
  • 3,028
  • 8
  • 48
  • 98
  • No time to look at this. Not quite a match, but lobbing a couple of links before heading out: [major upgrade failures](https://stackoverflow.com/questions/56989906/wix-does-not-uninstall-older-version/56991527#56991527), [services](https://stackoverflow.com/a/55087943/129130). – Stein Åsmul Aug 29 '19 at 07:51
  • **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. – Stein Åsmul Aug 29 '19 at 12:20
  • yes it's version 1 binary. – kudlatiger Aug 30 '19 at 01:58
  • OK, so that explains it all then. Try to shut down the service manually and then delete the service executable via Windows Explorer. See if it is locked somehow. Maybe we can see the WiX source on github.com? Avoid checking in any sensitive custom action code - obviously. The setup code itself is rarely sensitive. – Stein Åsmul Aug 30 '19 at 09:19
  • Is the version 1 binary a higher version than version 2? (downgrade scenario). If so, I would hack the version 2 version number by opening the binary in Visual Studio as a resource and just set a higher version number. This will allow you to use the exact old version with a new version number and no other changes. Saves you a rebuild of the old binary with old sources and hence prevents the resulting UAT and QA which people try to avoid. – Stein Åsmul Aug 30 '19 at 09:48

1 Answers1

2

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:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164