2017-04-04 4 views
0

J'utilise le Wix Toolset pour générer un fichier .msi pour mon application. Tout fonctionne lorsque je passe à une nouvelle version, sauf à chaque fois que je lance une installation plus récente, le programme ne détecte pas les fonctions déjà installées et utilise par défaut les fonctionnalités requises, ce qui signifie que l'utilisateur a installé l'une des autres fonctionnalités ils sont supprimés sauf si l'utilisateur les vérifie explicitement pour une nouvelle installation.Wix mise à niveau msi suppression des fonctionnalités déjà installées

Y at-il un moyen pour que .msi détecte quelles fonctions sont actuellement installées chaque fois qu'une version plus récente est installée?

  <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="@[email protected]" Version="@[email protected]" Manufacturer="@[email protected]" Language="1033"> 
      <Package InstallerVersion="400" Compressed="yes" InstallScope="perMachine" Comments="@[email protected]" Description="@[email protected]"/> 
      <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="@[email protected]" OnlyDetect="yes" Property="NEWERVERSIONDETECTED"/> 
       <UpgradeVersion Minimum="0.0.0" Maximum="@[email protected]" 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"> 
         @[email protected] 
         <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"> 
         @[email protected]  
         <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="@[email protected]\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> 
+0

semble étrange, les MigrateFeatureStates action standard devrait prendre soin de ce à moins que votre interface utilisateur est réinitialisant les états de retour aux valeurs « par défaut ». Je suggère de faire la mise à niveau deux fois, une fois avec l'interface utilisateur (msiexec/i install.msi/l * v UILog.txt) et une fois tranquillement (msiexec/je installer.msi/qn/l * v quietLog.txt) et voir ce que se produit avec les états de fonctionnalité. –

+0

vous pouvez utiliser (! FeatureID = 3) pour détecter si la fonction est installée. Consultez le lien pour plus d'informations: https://www.firegiant.com/wix/tutorial/com-expression-syntax-miscellanea/expression-syntax/ –

Répondre