重大升级后WiX删除Windows服务

时间:2016-08-12 14:48:04

标签: windows wix wix3.8

我发现在100个系统中大约有1个使用WiX进行重大升级的间歇性问题。在卸载旧版本的产品时会删除Windows服务,然后安装并启动安装新版本的产品。但是在1或2秒后,将卸载新版本的Windows服务。我认为这可能违反了组件规则或文件版本控制规则,例如this question,但我没有在WiX脚本中看到问题。我没有更改组件GUID或引用其他组件中的资源,而windows service exe从版本1.4.3升级到1.4.7。

升级失败后,我可以卸载新版本的产品,安装旧版本的产品,然后主要升级到新版本的产品,没有任何问题。在第一次初始升级失败后,所有其他升级都有效。任何帮助将不胜感激。

代码是:

<RemoveExistingProducts After="InstallExecute" />

<Component Id="ProgFiles" Guid="C692BAF6-17DB-4E8B-8225-9F0614080B16" Shared="no" Permanent="no">

        <ServiceInstall Id="InstallWindowsService"
                        Name="$(var.WindowsServiceName)"
                        DisplayName="[WINDOWS_SERVICE_DISPLAY_NAME]"
                        Type="ownProcess"
                        Start="auto"
                        ErrorControl="critical"
                        Description="$(var.AppDescription)">

            <ServiceConfig Id="WindowsServiceConfig"
                           DelayedAutoStart="yes"
                           OnInstall="yes"
                           OnReinstall="yes"/>              
        </ServiceInstall>
       <File Id='_04' DiskId='1' Name='Service.exe'                  Source='..\bin\$(var.BinariesToUse)\Service.exe' KeyPath='yes'/>
    </Component>
         <Component Id="ReleaseInstallRegEntries" Guid="5AB1B28B-C884-4230-9275-4095DDD06085" Shared="no" Permanent="no">
              <ServiceControl Id="WindowsServiceControl_USER"
                              Name="$(var.WindowsServiceName)"
                              Stop="both"
                              Start="install"
                              Remove="uninstall"
                              Wait="yes" />
            </Component>
    <Upgrade Id="$(var.UpgradeCode)">

    <UpgradeVersion Minimum="$(var.ProductVersion)"
                    IncludeMinimum="no"
                    OnlyDetect="yes"
                    Language="1033"
                    Property="NEWERPRODUCTFOUND" />

    <UpgradeVersion Minimum="0.0.0"
                    IncludeMinimum="yes"
                    Maximum="$(var.ProductVersion)"
                    IncludeMaximum="no"
                    Language="1033"
                    Property="UPGRADEFOUND" />

</Upgrade>

here

下载的整个msi安装日志

msi安装日志:

MSI (s) (60:74) [12:09:04:691]: Doing action: RemoveExistingProducts
MSI (s) (60:74) [12:09:04:691]: Note: 1: 2205 2:  3: ActionText 
Action ended 12:09:04: PublishProduct. Return value 1.
MSI (s) (60:74) [12:09:04:691]: Skipping RemoveExistingProducts action: current configuration is maintenance mode or an uninstall
Action start 12:09:04: RemoveExistingProducts.
MSI (s) (60:74) [12:09:04:691]: Doing action: CleanUpgradeFolder
MSI (s) (60:74) [12:09:04:691]: Note: 1: 2205 2:  3: ActionText 
Action ended 12:09:04: RemoveExistingProducts. Return value 0.
Action start 12:09:04: CleanUpgradeFolder.
MSI (s) (60:74) [12:09:04:691]: Skipping action: WixFailWhenDeferred (condition is false)
MSI (s) (60:74) [12:09:04:691]: Doing action: InstallFinalize
MSI (s) (60:74) [12:09:04:691]: Note: 1: 2205 2:  3: ActionText 
Action ended 12:09:04: CleanUpgradeFolder. Return value 1.
MSI (s) (60:74) [12:09:04:691]: Running Script: C:\Windows\Installer\MSI4518.tmp
MSI (s) (60:74) [12:09:04:691]: PROPERTY CHANGE: Adding UpdateStarted property. Its value is '1'.
MSI (s) (60:74) [12:09:04:769]: Note: 1: 2265 2:  3: -2147287035 
MSI (s) (60:74) [12:09:04:769]: Machine policy value 'DisableRollback' is 0
MSI (s) (60:74) [12:09:04:769]: Executing op: Header(Signature=1397708873,Version=500,Timestamp=1225810211,LangId=1033,Platform=0,ScriptType=1,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
Action start 12:09:04: InstallFinalize.
MSI (s) (60:74) [12:09:04:769]: Executing op: ProductInfo(ProductKey={2BFA1207-9A98-4D55-9182-5C433ED6A55A},ProductName=Dell Customer Connect,PackageName=OTBSurvey.1.4.3.0.msi,Language=1033,Version=17039363,Assignment=1,ObsoleteArg=0,ProductIcon=dnd.ico,,PackageCode={11C5914C-B010-41D1-B920-D4C97AC61404},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3)
MSI (s) (60:74) [12:09:04:769]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (60:74) [12:09:04:769]: Executing op: DialogInfo(Type=1,Argument=Dell Customer Connect)
MSI (s) (60:74) [12:09:04:769]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (60:74) [12:09:04:769]: Executing op: SetBaseline(Baseline=0,)
MSI (s) (60:74) [12:09:04:769]: Executing op: SetBaseline(Baseline=1,)
MSI (s) (60:74) [12:09:04:769]: Executing op: ActionStart(Name=InstallInitialize,,)
MSI (s) (60:74) [12:09:04:785]: Executing op: ProductUnregister(UpgradeCode={29D88272-5B32-4441-B6F3-568230D61331})
MSI (s) (60:74) [12:09:04:785]: Note: 1: 1402 2: UNKNOWN\Products\7021AFB289A955D41928C534E36D5AA5\Transforms 3: 2 
MSI (s) (60:74) [12:09:04:785]: Note: 1: 1402 2: UNKNOWN\Products\7021AFB289A955D41928C534E36D5AA5\Transforms 3: 2 
MSI (s) (60:74) [12:09:04:785]: Scheduling file 'C:\Windows\Installer\74bb8.msi' for deletion during post-install cleanup (not post-reboot).
MSI (s) (60:74) [12:09:04:800]: Note: 1: 1402 2: UNKNOWN\Products\7021AFB289A955D41928C534E36D5AA5\Usage 3: 2 
MSI (s) (60:74) [12:09:04:800]: Executing op: ProductCPDisplayInfoUnregister()
MSI (s) (60:74) [12:09:04:800]: Executing op: ProductUnpublish(PackageKey={11C5914C-B010-41D1-B920-D4C97AC61404})
MSI (s) (60:74) [12:09:04:800]: Using cached product context: machine assigned for product: 7021AFB289A955D41928C534E36D5AA5
MSI (s) (60:74) [12:09:04:816]: Executing op: UpgradeCodeUnpublish(UpgradeCode={29D88272-5B32-4441-B6F3-568230D61331})
MSI (s) (60:74) [12:09:04:816]: Executing op: IconRemove(Icon=dnd.ico,)
MSI (s) (60:74) [12:09:04:816]: Scheduling file 'C:\Windows\Installer\{2BFA1207-9A98-4D55-9182-5C433ED6A55A}\dnd.ico' for deletion during post-install cleanup (not post-reboot).
MSI (s) (60:74) [12:09:04:816]: Executing op: ProductUnpublishClient(,,)
MSI (s) (60:74) [12:09:04:816]: Note: 1: 1402 2: UNKNOWN\Installer\Products\7021AFB289A955D41928C534E36D5AA5 3: 2 
MSI (s) (60:74) [12:09:04:816]: Executing op: SourceListUnpublish(,)
MSI (s) (60:74) [12:09:04:816]: Note: 1: 1402 2: UNKNOWN\Installer\Products\7021AFB289A955D41928C534E36D5AA5\SourceList 3: 2 
MSI (s) (60:74) [12:09:04:816]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
MSI (s) (60:74) [12:09:04:816]: Executing op: ProgressTotal(Total=12,Type=1,ByteEquivalent=24000)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={F48BF778-F931-42C4-9D18-BE9A27E1D9F9},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={F48BF778-F931-42C4-9D18-BE9A27E1D9F9},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={9A35F430-54AA-4FD6-9936-DD72910CF898},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={9A35F430-54AA-4FD6-9936-DD72910CF898},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={DAA28A1B-1403-49C5-966E-E8C1989061D0},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={DAA28A1B-1403-49C5-966E-E8C1989061D0},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={4F8B0F06-392A-4963-8A99-B32F436F802D},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={4F8B0F06-392A-4963-8A99-B32F436F802D},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={1FF47611-4ABF-4A40-8278-133E73DF0461},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={1FF47611-4ABF-4A40-8278-133E73DF0461},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={A2612202-F609-4C42-8FBC-2BE733A3D1FB},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={A2612202-F609-4C42-8FBC-2BE733A3D1FB},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={9817EEDA-E4CC-4B5A-B97D-F9CF0C7DF493},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={9817EEDA-E4CC-4B5A-B97D-F9CF0C7DF493},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={23FB7BF8-C385-4FE2-8A3F-AC4D7BE23CAF},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={23FB7BF8-C385-4FE2-8A3F-AC4D7BE23CAF},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={350DEE79-78D9-46B6-8442-90A9299C8DDD},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={350DEE79-78D9-46B6-8442-90A9299C8DDD},,BinaryType=0,)
MSI (s) (60:74) [12:09:04:832]: Executing op: UnregisterSharedComponentProvider(Component={8B227A34-6400-433B-84BD-F4BA9CC26E75},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:832]: Executing op: ComponentUnregister(ComponentId={8B227A34-6400-433B-84BD-F4BA9CC26E75},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:832]: Executing op: UnregisterSharedComponentProvider(Component={0DE95021-65AC-47DD-9158-A931C0363522},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:832]: Executing op: ComponentUnregister(ComponentId={0DE95021-65AC-47DD-9158-A931C0363522},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:832]: Executing op: UnregisterSharedComponentProvider(Component={CB46CF46-8580-4739-84BE-A7F8005B88AA},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:832]: Executing op: ComponentUnregister(ComponentId={CB46CF46-8580-4739-84BE-A7F8005B88AA},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:832]: Executing op: ActionStart(Name=UnpublishFeatures,Description=Unpublishing Product Features,Template=Feature: [1])
MSI (s) (60:74) [12:09:04:832]: Executing op: FeatureUnpublish(Feature=MainFeature,,Absent=2,Component=oOhZwZc(O93_IgYZf`AysfrWYMS(aAH`zvLW+y1YKOr=oNHBe?(lECg)&h{kng%XA4jrY?**1D3.j'^2of{=-h$Or?u3qy72QN3GP8%4]bMHS@-6DAsx2KxyL5%tX%L]6@$$_pk6?{VWgq~W.N@IbAAYxz@snACa!~H'5xXlf=$O@R_YxY5p*P!fTand[9pcL*el).hM7d&P'`i=+?B@dz3w@T~-Pn@DjY@kt=bq}vxbrim_)
MSI (s) (60:74) [12:09:04:832]: Note: 1: 1402 2: UNKNOWN\Installer\Features\7021AFB289A955D41928C534E36D5AA5 3: 2 
MSI (s) (60:74) [12:09:04:832]: Executing op: ActionStart(Name=StopServices,Description=Stopping services,Template=Service: [1])
MSI (s) (60:74) [12:09:04:832]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
MSI (s) (60:74) [12:09:04:832]: Executing op: ServiceControl(,Name=Dell Customer Connect,Action=2,Wait=1,)
MSI (s) (60:74) [12:09:19:681]: Executing op: ActionStart(Name=DeleteServices,Description=Deleting services,Template=Service: [1])
MSI (s) (60:74) [12:09:19:681]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
MSI (s) (60:74) [12:09:19:681]: Executing op: ServiceControl(,Name=Dell Customer Connect,Action=8,Wait=1,)
MSI (s) (60:74) [12:09:19:681]: Executing op: ActionStart(Name=InstallFiles,Description=Copying new files,Template=File: [1],  Directory: [9],  Size: [6])
MSI (s) (60:74) [12:09:19:681]: Executing op: RemoveBaseline(ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A},ProductVersion=1.4.3)
MSI (s) (60:74) [12:09:19:681]: Verifying accessibility of file: _01
MSI (s) (60:74) [12:09:19:696]: Verifying accessibility of file: _04
MSI (s) (60:74) [12:09:19:696]: Verifying accessibility of file: _05
MSI (s) (60:74) [12:09:19:696]: Verifying accessibility of file: _06
MSI (s) (60:74) [12:09:19:712]: Verifying accessibility of file: _16
MSI (s) (60:74) [12:09:19:712]: Verifying accessibility of file: _17
MSI (s) (60:74) [12:09:19:728]: Verifying accessibility of file: _19
MSI (s) (60:74) [12:09:19:728]: Verifying accessibility of file: _20
MSI (s) (60:74) [12:09:19:728]: Verifying accessibility of file: _21
MSI (s) (60:74) [12:09:19:743]: Verifying accessibility of file: _22
MSI (s) (60:74) [12:09:19:743]: Verifying accessibility of file: _40
MSI (s) (60:74) [12:09:19:771]: Verifying accessibility of file: _41
MSI (s) (60:74) [12:09:19:786]: Verifying accessibility of file: _42
MSI (s) (60:74) [12:09:19:786]: Verifying accessibility of file: _43
MSI (s) (60:74) [12:09:19:802]: Verifying accessibility of file: _44
MSI (s) (60:74) [12:09:19:802]: Verifying accessibility of file: _77
MSI (s) (60:74) [12:09:19:802]: Verifying accessibility of file: _78
MSI (s) (60:74) [12:09:19:818]: Verifying accessibility of file: _79
MSI (s) (60:74) [12:09:19:818]: Verifying accessibility of file: _80
MSI (s) (60:74) [12:09:19:818]: Verifying accessibility of file: _81
MSI (s) (60:74) [12:09:19:818]: Verifying accessibility of file: _82
MSI (s) (60:74) [12:09:19:833]: Note: 1: 2318 2: C:\Windows\Installer\$PatchCache$\Managed\7021AFB289A955D41928C534E36D5AA5\CacheSize.txt 
MSI (s) (60:74) [12:09:19:833]: Executing op: RemoveBaseline(ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A},)
MSI (s) (60:74) [12:09:19:833]: Verifying accessibility of file: CacheSize.txt
MSI (s) (60:74) [12:09:19:833]: Executing op: ActionStart(Name=PublishProduct,Description=Publishing product information,)
MSI (s) (60:74) [12:09:19:833]: Executing op: CleanupConfigData()
MSI (s) (60:74) [12:09:19:833]: Executing op: RegisterPatchOrder(Continue=0,SequenceType=0,Remove=1)
MSI (s) (60:74) [12:09:19:833]: Note: 1: 1402 2: UNKNOWN\Installer\Products\7021AFB289A955D41928C534E36D5AA5\Patches 3: 2 
MSI (s) (60:74) [12:09:19:833]: Executing op: RegisterPatchOrder(Continue=0,SequenceType=1,Remove=1)
MSI (s) (60:74) [12:09:19:833]: Executing op: CleanupConfigData(RemovingProduct=1)
MSI (s) (60:74) [12:09:19:833]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\7021AFB289A955D41928C534E36D5AA5\Patches 3: 2 
MSI (s) (60:74) [12:09:19:833]: Executing op: ActionStart(Name=CleanUpgradeFolder,,)
MSI (s) (60:74) [12:09:19:833]: Executing op: CustomActionSchedule(Action=CleanUpgradeFolder,ActionType=3110,Source='MsgBox Session.Property("CleanUpgradeFolder")

      'delete the settings file:

      Set filesys = CreateObject("Scripting.FileSystemObject")
      sSettingsFilePath = "C:\ProgramData\Dell\OTBS\OTBSService.State.settings"

      If filesys.FileExists(sSettingsFilePath) Then
        filesys.DeleteFile sSettingsFilePath
      End If,,)
MSI (s) (60:74) [12:09:19:833]: Creating MSIHANDLE (7) of type 790536 for thread 884
MSI (s) (60:78) [12:09:19:833]: Creating MSIHANDLE (8) of type 0 for thread 1912
MSI (s) (60:78) [12:09:19:861]: Closing MSIHANDLE (8) of type 0 for thread 1912
MSI (s) (60:78) [12:09:19:861]: Closing MSIHANDLE (7) of type 790536 for thread 884
MSI (s) (60:74) [12:09:19:861]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=2888000)
MSI (s) (60:74) [12:09:19:877]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.

Windows服务日志:

2016-08-16 17:08:59,522 [1776] INFO  Service shutting down.    [ShutDownService]
2016-08-16 17:08:59,616 [1776] DEBUG    Service Stopped    [PreStopOperations]
2016-08-16 17:09:03,488 [3868] INFO  Service Started; Client Version: 1.4.7.0; OS: WIN8; Thread UI: en-US; Installed UI: en-US    [OnStart]
2016-08-16 17:09:04,832 [3868] INFO  OTBSurveyService: Stop event received    [OnStop]
2016-08-16 17:09:04,847 [3868] INFO  Service shutting down.    [ShutDownService]
2016-08-16 17:09:18,931 [3868] DEBUG    Service Stopped    [PreStopOperations]

1 个答案:

答案 0 :(得分:0)

您描述的事件序列为&#34; Windows服务在卸载旧版本产品时被删除,然后安装并开始安装新版本的产品&#34;几乎肯定是错误的,基于日志和RemoveExistingProducts文档。升级为afterInstallExecute时的实际事件顺序是首先安装新版本,然后卸载旧产品。

停止旧服务(来自升级安装)是在12:08:59,然后删除旧服务。 然后安装新服务,并在12:09:03.222启动,服务配置操作也在那里进行。 在12:09:04.535 RemoveExistingProducts运行,卸载旧产品。卸载有一个ServiceControl在12:09:04:832停止服务(刚刚安装),因为你的ServiceControl有stop = both,这意味着它将在卸载时停止它,这是卸载旧的产品。

由于这是静态定义的行为,因此对变量行为的最可能解释可能是时间竞争。例如,新安装的服务可能尚未准备好接受大多数安装中的停止请求,因此在旧产品卸载时不会停止。但有时它确实会响应并关闭。

然而,除了理论之外,底线仍然是你有一个ServiceControl stop = both的代码,并且带有stop的旧产品的卸载是最后发生的事情(并注意你只在安装时启动,不是卸载!)。您可能需要更改升级顺序,因为stop =两者都在较旧的已安装产品中,并且无法修复,例如,无需使用修补程序更改它。你的升级afterInstallInitialize应该没问题,因为安装实际上是在卸载旧产品之后。