How to use MajorUpgrade and RemoveFeatures to remove only specific features and still un-install the previous version of the product

StackOverflow https://stackoverflow.com/questions/15638632

  •  29-03-2022
  •  | 
  •  

Question

I swapped to Wix 3.6 from the Microsoft Installer that was packaged with VS 2010. I am trying to release a seamless upgrade to our users by using the <MajorUpgrade/> Tag, however I have one feature that I do not want to be un-installed while performing this major upgrade.

As seen below I have RemoveFeatures="[ProductFeature]" which will result in only the ProductFeature being removed and the DataFeature will remain, but this results in the entry not being removed from the "Programs and Features" list in Windows as it is when this parameter is not specified. How can I upgrade properly without un-installing specific features?

<Product Id="*" 
       Name="$(var.MyProject.ProjectName)" 
       Language="1033" 
       Version="2.6.0.0" 
       Manufacturer="Awesome Software (Pty) Ltd"          
       UpgradeCode="D7B99D7F-340D-449D-9C18-5D4A4A9B13D5">       
<Package InstallerVersion="405"
         Compressed="yes"              
         Description="Installs $(var.MyProject.ProjectName)"             
     Keywords="Awesome"
     InstallScope="perMachine"/>

<WixVariable Id="WixUILicenseRtf" Value="$(var.SolutionDir)\awesome.EULA\awesome CE Eula.rtf" />
<MediaTemplate EmbedCab="yes"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." 
RemoveFeatures="[ProductFeature]" Schedule="afterInstallInitialize"/>

<Feature Id="ProductFeature" Title="Setup $(var.MyProject.ProjectName)" Level="1">      
  <ComponentGroupRef Id="FilesFragment" />
  <ComponentRef Id="C__5B1F76E18B8F479DAAA1B8C14E4B0638"/>
  <ComponentRef Id="C__5B1F76E18B8F479DAAA1B8C14E4B0639"/>
  <ComponentRef Id="cmpA0688C6933D519CB5D1B6D48D50F1E21"/>
</Feature>

<Feature Id="DataFeature" Title="Data $(var.MyProject.ProjectName)" Level="1" >
  <ComponentGroupRef Id="DataFragment" />
</Feature>

<!-- Wix UI Prompts -->
<Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONFOLDER"/>            
<UIRef Id="WixUI_InstallDir"/>

<Binary Id="myCustomActionsDLL" SourceFile="$(var.CustomActions.TargetDir)MaxCut.CustomActions.CA.dll"/>

<InstallExecuteSequence>
  <Custom Action="CA_myCustomAction" Before="InstallInitialize"/>
</InstallExecuteSequence>

Was it helpful?

Solution

If you don't uninstall all the features, the Windows Installer will keep the old product on the machine. This often happens when a Condition under a Feature evaluates to false during uninstall. You've found another way to hit that scenario. This confuses people pretty much every time it happens.

Short answer: you can't do what you are trying to do with features.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top