[wix-users] Wix Source File Changes Needed to Allow Multiple Versions to Exist on System?

Schooley, Ron ron.schooley at hpe.com
Fri Mar 24 14:33:09 PDT 2017


I am in the process of trying to use WiX to replace an old Visual Studio Project (which builds an MSI). I believe this project is somewhat unique in that every installer file it produces (after modifying various settings, of course) can be installed with any other version that has ever been previously installed (or will be installed in the future). With the Visual Studio Project, we simply change the Product Code, Package Code, Product Upgrade Code, and Version Values (and provide unique Program Folder and Shortcut Names) to make this happen.

Using WiX, I am able to create two installer files that seems to install everything as expected. Although uninstalls run to completion, the program files folder/shortcuts and desktop shortcuts do not seem to get removed as expected. Needless to say, I am a bit perplexed as to what is going on here.

As you can see from below, I have two installer file that differ with 1) the Product UpgradeCode, 2) the Product Version, 3) Folder & Shortcut Names (and various comments).

What is missing? Do all new GUIDs have to be provided for every single component whenever a new version of the program gets released?

-Ron

--- TEST1.WXS ---
<?xml version="1.0" encoding="UTF-8"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

   <Product Id="*"
            Language="1033"
            Manufacturer="Product Manufacturer"
            Name="Product Version 1"
            UpgradeCode="{940D891C-6AB4-463A-8526-143D1081AA83}"
            Version="1.0.0.0">

      <Package Id="*"
               Comments="This installer database contains the logic and data required to install Product Version 1."
               Compressed="yes"
               Description="Product Version 1 Installation Database"
               InstallScope="perMachine"
               Keywords="MSI,Installer"
               Manufacturer="Product Manufacturer" />

      <UIRef Id="WixUI_InstallDir" />
      <MediaTemplate EmbedCab="yes" />

      <Property Id="ARPCOMMENTS" Value="This installation database contains the logic and data required to install Product Version 1." />
      <Property Id="ARPCONTACT" Value="Product Manufacturer" />

      <Property Id="WIXUI_DONTVALIDATEPATH" Value="1" />
      <Property Id="WIXUI_INSTALLDIR" Value="MAINDIRECTORY" />

      <Directory Id="TARGETDIR" Name="SourceDir">
         <Directory Id="ProgramFilesFolder">
            <Directory Id="MAINDIRECTORY" Name="Product Version 1" />
         </Directory>
         <Directory Id="DesktopFolder" />
         <Directory Id="ProgramMenuFolder">
            <Directory Id="StartMenuDirectory" Name="Product Version 1" />
         </Directory>
      </Directory>

      <Feature Id="MainProduct" Level="1" Title="Main Product">
         <ComponentGroupRef Id="COMPGROUP_MAINDIRECTORY" />
         <ComponentGroupRef Id="COMPGROUP_DesktopFolder" />
         <ComponentGroupRef Id="COMPGROUP_StartMenuDirectory" />
      </Feature>

      <ComponentGroup Id="COMPGROUP_MAINDIRECTORY" Directory="MAINDIRECTORY">
         <Component Id="COMP_MAINDIRECTORY_text.txt" Guid="{DDE02E0B-D9B8-4114-9434-5659B6B48D61}">
            <File KeyPath="yes" ReadOnly="yes" Source="d:\ver1\test1.txt" />
        </Component>
      </ComponentGroup>

      <ComponentGroup Id="COMPGROUP_DesktopFolder" Directory="DesktopFolder">
         <Component Id="COMP_DesktopFolder_Shortcuts" Guid="{6832063A-AC4D-4201-9A3D-39F7CFD55CF5}">
            <Shortcut Id="DSC_text.txt" Description="Runs Product Version 1" Name="Product Version 1" Target="[MAINDIRECTORY]test1.txt" WorkingDirectory="MAINDIRECTORY" />
            <RegistryValue Root="HKCU" Key="Software\Product Version 1" Name="installed" Type="integer" Value="1" KeyPath="yes" />
         </Component>
      </ComponentGroup>

      <ComponentGroup Id="COMPGROUP_StartMenuDirectory" Directory="StartMenuDirectory">
         <Component Id="COMP_StartMenuDirectory_Shortcuts" Guid="{671D25E8-E2AA-47D2-8B50-79143191C667}">
            <Shortcut Id="SC_text.txt" Description="Runs Product Version 1" Name="Product Version 1" Target="[MAINDIRECTORY]test1.txt" WorkingDirectory="MAINDIRECTORY" />
            <Shortcut Id="SC_msiexec.exe" Description="Uninstalls Product Version 1" Name="Uninstall" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]" />
            <RemoveFolder Id="DeleteStartMenuDirectory" Directory="StartMenuDirectory" On="uninstall" />
            <RegistryValue Root="HKCU" Key="Software\Product Version 1" Name="installed" Type="integer" Value="1" KeyPath="yes" />
         </Component>
      </ComponentGroup>

   </Product>

</Wix>


--- TEST2.WXS ---
<?xml version="1.0" encoding="UTF-8"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

   <Product Id="*"
            Language="1033"
            Manufacturer="Product Manufacturer"
            Name="Product Version 2"
            UpgradeCode="{B8DCA0B6-FD6B-4968-86AF-5FA286590EAB}"
            Version="2.0.0.0">

      <Package Id="*"
               Comments="This installer database contains the logic and data required to install Product Version 2."
               Compressed="yes"
               Description="Product Version 2 Installation Database"
               InstallScope="perMachine"
               Keywords="MSI,Installer"
               Manufacturer="Product Manufacturer" />

      <UIRef Id="WixUI_InstallDir" />
      <MediaTemplate EmbedCab="yes" />

      <Property Id="ARPCOMMENTS" Value="This installation database contains the logic and data required to install Product Version 2." />
      <Property Id="ARPCONTACT" Value="Product Manufacturer" />

      <Property Id="WIXUI_DONTVALIDATEPATH" Value="1" />
      <Property Id="WIXUI_INSTALLDIR" Value="MAINDIRECTORY" />

      <Directory Id="TARGETDIR" Name="SourceDir">
         <Directory Id="ProgramFilesFolder">
            <Directory Id="MAINDIRECTORY" Name="Product Version 2" />
         </Directory>
         <Directory Id="DesktopFolder" />
         <Directory Id="ProgramMenuFolder">
            <Directory Id="StartMenuDirectory" Name="Product Version 2" />
         </Directory>
      </Directory>

      <Feature Id="MainProduct" Level="1" Title="Main Product">
         <ComponentGroupRef Id="COMPGROUP_MAINDIRECTORY" />
         <ComponentGroupRef Id="COMPGROUP_DesktopFolder" />
         <ComponentGroupRef Id="COMPGROUP_StartMenuDirectory" />
      </Feature>

      <ComponentGroup Id="COMPGROUP_MAINDIRECTORY" Directory="MAINDIRECTORY">
         <Component Id="COMP_MAINDIRECTORY_text.txt" Guid="{DDE02E0B-D9B8-4114-9434-5659B6B48D61}">
            <File KeyPath="yes" ReadOnly="yes" Source="d:\ver2\test1.txt" />
         </Component>
      </ComponentGroup>

      <ComponentGroup Id="COMPGROUP_DesktopFolder" Directory="DesktopFolder">
         <Component Id="COMP_DesktopFolder_Shortcuts" Guid="{6832063A-AC4D-4201-9A3D-39F7CFD55CF5}">
            <Shortcut Id="DSC_text.txt" Description="Runs Product Version 2" Name="Product Version 2" Target="[MAINDIRECTORY]test1.txt" WorkingDirectory="MAINDIRECTORY" />
            <RegistryValue Root="HKCU" Key="Software\Product Version 2" Name="installed" Type="integer" Value="1" KeyPath="yes" />
         </Component>
      </ComponentGroup>

      <ComponentGroup Id="COMPGROUP_StartMenuDirectory" Directory="StartMenuDirectory">
         <Component Id="COMP_StartMenuDirectory_Shortcuts" Guid="{671D25E8-E2AA-47D2-8B50-79143191C667}">
            <Shortcut Id="SC_text.txt" Description="Runs Product Version 2" Name="Product Version 2" Target="[MAINDIRECTORY]test1.txt" WorkingDirectory="MAINDIRECTORY" />
            <Shortcut Id="SC_msiexec.exe" Description="Uninstalls Product Version 2" Name="Uninstall" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]" />
            <RemoveFolder Id="DeleteStartMenuDirectory" Directory="StartMenuDirectory" On="uninstall" />
            <RegistryValue Root="HKCU" Key="Software\Product Version 2" Name="installed" Type="integer" Value="1" KeyPath="yes" />
         </Component>
      </ComponentGroup>

   </Product>

</Wix>



More information about the wix-users mailing list