Wix升级msi删除已安装的功能

Wix升级msi删除已安装的功能,wix,wix3,Wix,Wix3,我正在使用Wix工具集为我的应用程序生成一个.msi。当我升级到新版本时,一切正常,除非每次我运行更新版本的安装,否则安装程序不会检测到已安装的功能,而是默认为“必需”的功能,这意味着如果用户安装了任何其他功能,则这些功能将被删除,除非用户再次显式检查是否安装 是否有必要让.msi在每次安装较新版本时检测当前安装的功能 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://s

我正在使用Wix工具集为我的应用程序生成一个.msi。当我升级到新版本时,一切正常,除非每次我运行更新版本的安装,否则安装程序不会检测到已安装的功能,而是默认为“必需”的功能,这意味着如果用户安装了任何其他功能,则这些功能将被删除,除非用户再次显式检查是否安装

是否有必要让.msi在每次安装较新版本时检测当前安装的功能

            <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
          <Product Id="*" UpgradeCode="9e578e3d-0119-425c-8633-f54ffaaa4929" Name="@product.name@" Version="@product.version@" Manufacturer="@product.company@" Language="1033">
            <Package InstallerVersion="400" Compressed="yes" InstallScope="perMachine" Comments="@product.version@" Description="@product.description@"/>
            <Media Id="1" Cabinet="myapp.cab" EmbedCab="yes" />

            <!-- Installer Properties -->
            <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
            <PropertyRef Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED"/>

            <!-- Check Existing Install -->
            <Upgrade Id="9e578e3d-0119-425c-8633-f54ffaaa4929">
                <UpgradeVersion Minimum="@product.version@" OnlyDetect="yes" Property="NEWERVERSIONDETECTED"/>
                <UpgradeVersion Minimum="0.0.0" Maximum="@product.version@" IncludeMinimum="yes" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED"/>   
            </Upgrade>
            <Condition Message="A newer version of this software is already installed.">NOT NEWERVERSIONDETECTED</Condition>

            <!-- Prerequisites -->
            <Condition Message="This application requires .NET Framework 4.6 or newer. Please install the .NET Framework then run this installer again.">
                <![CDATA[Installed OR WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED]]>
            </Condition>

            <Condition Message="This application is only supported on Windows 7, Windows Server 2008 R2 or higher.">
                <![CDATA[Installed OR (VersionNT >= 601)]]>
            </Condition>

    ...

    <Feature Id="Feature_Application"
                         Title="Application"
                         ConfigurableDirectory="APPLICATIONDIR"
                         Level="1"
                         AllowAdvertise="no">
                        @product.applicationcomponents@
                        <ComponentRef Id="ApplicationShortcut" />                    
                        <ComponentRef Id="CleanupApplicationData" />                    
        </Feature>

        <!--  Feature: My Service -->
        <Feature Id="Feature_Service"
                         Title="My Service"
                         Description="My Service"
                         ConfigurableDirectory="REPORTDIR"
                         Level="3"
                         AllowAdvertise="no">
                        @product.servicecomponents@    
                        <ComponentRef Id="ServiceShortcut" />                    
            <Component Id="MyServiceInstaller_ServiceControl" Guid="B72CAA3F-F2DB-48D2-90DD-061209AB2CE5" Directory="REPORTDIR">
                <CreateFolder />
                <File Id="MyService.exe" Name="MyService.exe" KeyPath="yes" Source="@product.sourcedir@\MyService\MyService.exe"/>
                <ServiceInstall Id="MyServiceInstaller_ServiceInstall"
                    Type="ownProcess"
                    Vital="yes"
                    Name="Windows Service"                    
                    DisplayName="Windows Service"
                    Description="Windows service"
                    Start="auto"
                    Account="NT AUTHORITY\LocalService"
                    ErrorControl="ignore"
                    Interactive="no" />
                <ServiceControl Id="MyServiceInstaller_ServiceInstall" 
                    Name="My Service"
                    Stop="both"
                    Remove="uninstall"
                    Wait="yes" />               
            </Component>     

        </Feature>

    <InstallExecuteSequence>
        <RemoveExistingProducts After="InstallValidate"/>
    </InstallExecuteSequence>   

    <UIRef Id="WixUI_FeatureTree" />
    <UI>
      <DialogRef Id="FilesInUse" />
      <DialogRef Id="MsiRMFilesInUse" />
      <!-- Add the GUI logic for installation -->
    </UI>
  </Product>

未检测到新的错误
= 601)]]>
...
@product.applicationcomponents@
@product.servicecomponents@

尝试使用
MajorUpgrade
标记

`<MajorUpgrade DowngradeErrorMessage="Can’t downgrade." />`
``

这似乎有些奇怪,除非您的UI将状态重新设置为“默认”值,否则MigrateFeatureState标准操作应该解决这个问题。我建议升级两次,一次使用UI(msiexec/I install.msi/lv UILog.txt),一次使用静默(msiexec/I install.msi/qn/lv quietLog.txt),然后查看功能状态的变化。您可以使用(!FeatureID=3)检测功能是否已安装。查看链接以了解更多信息: