Cannot update windows service using .msi

Problem:

I made a Windows VS2010 service (C #) and the corresponding .msi that installs and starts it. Version, ProductCode, UpgradeCode, etc. Installed correctly. RemovePreviousVersions is true. It works great.

Now I want to create a new version of the service, and I want the updated .msi to update the service, without requiring the user to manually delete the old service first.

What am I doing:

  • I am updating the source code of my service
  • In the .msi project, I change the version number and ProductCode (leaving the UpgradeCode code unchanged)
  • I am rebuilding all this.

But when I launched the updated .msi, it did not fulfill the following message: "Error 1001 .... The service instance is already running."

Questions:

  • Why was the service not automatically uninstalled before installing the updated version?

  • What can I do to make it work?

+4
source share
1 answer

Changes in Windows Installer 5.0 are not of interest for this situation; they relate to failure configurations.

Since uninstalling the application manually from the control panel deletes the service, it becomes clear that installing a new version does not delete the previous one. To check why you need to create a verbose log and check the standard RemoveExistentProducts action. To create a log, use this command

msiexec / i {msi path} / l * v file.log

You should know that you must change one of the first three version numbers to make sure that the OS is considering a new service pack, the fourth is ignored. In addition, you must ensure that the packages have the same installation type, that is, on the user or on the machine. If the installation types are different, the update is skipped.

+1
source

Source: https://habr.com/ru/post/1443458/


All Articles