简体   繁体   中英

Wix Installer error during upgrade-The setup must update files or services that cannot be updated while system is running

I come upon the warning message during uninstalls a product or major updates in the uninstall phase (when a product service is running):

"The setup must update files or service that cannot be updated while the system is running. If you choose continue, a reboot will be required to complete the setup."

Story starts here

I have developed the windows service and created the installer [msi] using Wix , then distributed to users. it is working as expected.

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

But I get below error

The setup must update files or services that cannot be updated while the system is running

To support MSI upgrade, I have made below changes

Existing code for Product section

  <?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)">

Changed code , Here Product ID changed to *

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

Observe that upgrade code is not changed from old version to new version.

Existing code for upgrade

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

Updated code for upgrade

      <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeErrorMessage)"
                AllowDowngrades="no"
                AllowSameVersionUpgrades="yes" 
                RemoveFeatures="ALL" 
                Schedule="afterInstallInitialize"/>

Is it anything to do with service?

     <ServiceControl Id="myservice"
                    Name="GatewayService"
                    Start="install"
                    Stop="both"
                    Remove="uninstall" Wait="yes" />

Install Sequence

在此处输入图片说明

How to get rid of this prompt? Also why it's coming if service is stopped.

在此处输入图片说明

Some part of logs

     MSI (s) (78:5C) [19:54:21:691]: WIN64DUALFOLDERS: Substitution in 'C:\Program Files (x86)\Service\Service.dll' folder had been blocked by the 1 mask argument (the folder pair's iSwapAttrib member = 0).
     The setup must update files or services that cannot be updated while 
     the system is running. If you choose to continue, a reboot will be 
     required to complete the setup.
     MSI (s) (78:5C) [19:54:53:705]: Note: 1: 2727 2:  
     MSI (s) (78:5C) [19:54:53:706]: Doing action: RemoveExistingProducts
     MSI (s) (78:5C) [19:54:53:706]: Note: 1: 2205 2:  3: ActionText 
     Action ended 19:54:53: InstallValidate. Return value 1.
     MSI (s) (78:5C) [19:54:53:706]: Skipping RemoveExistingProducts action: 
     current configuration is maintenance mode or an uninstall
     Action start 19:54:53: RemoveExistingProducts.
     MSI (s) (78:5C) [19:54:53:706]: Doing action: InstallInitialize
     MSI (s) (78:5C) [19:54:53:706]: Note: 1: 2205 2:  3: ActionText 
     Action ended 19:54:53: RemoveExistingProducts. Return value 0.
     MSI (s) (78:5C) [19:54:53:708]: Machine policy value 'AlwaysInstallElevated' is 0
     MSI (s) (78:5C) [19:54:53:708]: User policy value 'AlwaysInstallElevated' is 0

I have below code to restart service on failure. do u think it causes issue?

       <util:ServiceConfig xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
                FirstFailureActionType="restart"
                SecondFailureActionType="restart"
                ThirdFailureActionType="restart" />

Issue root cause

I see that old version is not getting deleted during upgrade. Hence created a new question here Wix installer upgrade with same "upgrade code" ID shows privilege error prompt

Issue resolved. Culprit was below code

    <util:ServiceConfig xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
            FirstFailureActionType="restart"
            SecondFailureActionType="restart"
            ThirdFailureActionType="restart" />

I have added delay as follow, and everything working like charm now.

     RestartServiceDelayInSeconds="60"

Thanks to someone who thought the need for RestartServiceDelayInSeconds . Great thinking during ServiceConfig utility development

So I was installing MongoDB and this message kept popping up. I tried clicking on OK thinking that it would reboot the system but nothing happened. Then I turned off my internet and retried. It worked. This was weird but that's how my problem got resolved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM