title: Wix installer does not overwrite previous version of an executable
body: <p>I have a very simple installer - copy a single dll to a Program Files subfolder and register it with regsvr32.exe. Works great, but if an older version of the dll is installed, "Repair" does not overwrite the existing dll. The dll is signed and its version (build) number is always incremented (e.g. 2.0.0.123 - > 2.0.0.124).</p>
  
  <p>Looking at the previous similar posts, I added RemoveExistingProducts and specified ProductId as "*". Uninstalling and then installing the newer version works fine, but I really need Repair to update the existing dll.</p>
  
  <p>Is there anything else I need to do?</p>
  
  <p>Thank you!</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"&gt;
  
    &lt;!--
  When creating a new install for the next version, these fields must be modified
  --&gt;
    &lt;?define ProductVersion = "2.0.00" ?&gt;
  
    &lt;?define ProductId64 = "*" ?&gt;
    &lt;?define ProductId32 = "*" ?&gt;
  
    &lt;?define PackageId   = "45F34788-66AC-441C-B666-707FFA7F1EE9" ?&gt;
  
  
    &lt;!-- Product name as you want it to appear in Add/Remove Programs--&gt;
    &lt;?if $(var.Platform) = x64 ?&gt;
    &lt;?define ProductName = "XYZ (64 bit)" ?&gt;
    &lt;?define Win64 = "yes" ?&gt;
    &lt;?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?&gt;
    &lt;?define ProductId = "$(var.ProductId64)" ?&gt;
    &lt;?define MainDllName = "XYZ64.dll" ?&gt;
    &lt;?define MainDllSource = "..\..\bin\Win64\Release\XYZ64.dll" ?&gt;
    &lt;?else ?&gt;
    &lt;?define ProductName = "XYZ (32 bit)" ?&gt;
    &lt;?define Win64 = "no" ?&gt;
    &lt;?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?&gt;
    &lt;?define ProductId = "$(var.ProductId32)" ?&gt;
    &lt;?define MainDllName = "XYZ.dll" ?&gt;
    &lt;?define MainDllSource = "..\..\bin\Win32\Release\XYZ.dll" ?&gt;
    &lt;?endif ?&gt;
  
  
    &lt;?define UpgradeCode = "{C3763742-7C1C-4AB7-A404-F030B7550E97}" ?&gt;
  
  
    &lt;Product Id="$(var.ProductId)" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Advanced Messaging Systems LLC" UpgradeCode="$(var.UpgradeCode)"&gt;
  
      &lt;Package Id="$(var.PackageId)" InstallerVersion="200" Compressed="yes" Description="XYZ Installer package"  InstallPrivileges="elevated"/&gt;
  
      &lt;!-- No restore point  --&gt;
      &lt;Property Id="MSIFASTINSTALL" Value="3" /&gt;
  
     &lt;Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /&gt;
  
      &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
        &lt;Directory Id="$(var.PlatformProgramFilesFolder)"&gt;
          &lt;Directory Id="INSTALLLOCATION" Name="XYZ"&gt;
  
            &lt;Component Id="XYZDll" Guid="E2CBEE41-6C0E-4A84-95C1-7282747B4A3D"&gt;
              &lt;File Id='MainDll' Name="$(var.MainDllName)" DiskId='1' Source="$(var.MainDllSource)" SelfRegCost="0" /&gt;
  
              &lt;!-- TODO: Insert files, registry keys, and other resources here. --&gt;
            &lt;/Component&gt;
  
          &lt;/Directory&gt;
        &lt;/Directory&gt;
      &lt;/Directory&gt;
  
      &lt;Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" /&gt;
  
      &lt;!-- Note: Custom actions to install/uninstall the dll using regsvr32.exe --&gt;
      &lt;CustomAction Id="RegisterDll"
                        Directory="INSTALLLOCATION"
                        ExeCommand='regsvr32.exe /s "[INSTALLLOCATION]$(var.MainDllName)"'
  
                        Return="check"&gt;
      &lt;/CustomAction&gt;
      &lt;CustomAction Id="UnregisterDll"
                    Directory="INSTALLLOCATION"
                    ExeCommand='regsvr32.exe /s /u "[INSTALLLOCATION]$(var.MainDllName)"'&gt;
      &lt;/CustomAction&gt;
  
  
      &lt;Feature Id="ProductFeature" Title="XYZ" Level="1"&gt;
        &lt;ComponentRef Id="XYZDll" /&gt;
        &lt;!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. --&gt;
        &lt;ComponentGroupRef Id="Product.Generated" /&gt;
      &lt;/Feature&gt;
  
      &lt;InstallUISequence&gt;
        &lt;Custom Action="WixCloseApplications" Before="AppSearch"/&gt;
      &lt;/InstallUISequence&gt;
  
      &lt;InstallExecuteSequence&gt;
  
        &lt;!-- Uninstall previous version before installing this one. --&gt;
        &lt;RemoveExistingProducts Before="InstallInitialize"/&gt;
  
  
        &lt;SelfRegModules/&gt;
      &lt;/InstallExecuteSequence&gt;
  
      &lt;Icon Id="XYZ.ico" SourceFile="..\Graphics\XYZ.ico"/&gt;
      &lt;Property Id="ARPPRODUCTICON" Value="XYZ.ico" /&gt;
  
      &lt;!-- UI --&gt;
      &lt;UIRef Id="WixUI_InstallDir"/&gt;
      &lt;UIRef Id="WixUI_ErrorProgressText" /&gt;
  
      &lt;WixVariable Id="WixUILicenseRtf" Value="..\EULA\license.rtf" /&gt;
      &lt;WixVariable Id="WixUIBannerBmp"  Value="..\Graphics\banner.jpg" /&gt;
      &lt;WixVariable Id="WixUIDialogBmp"  Value="..\Graphics\logo.jpg" /&gt;
  
  
      &lt;!-- End UI --&gt;
    &lt;/Product&gt;
  &lt;/Wix&gt;
  </code></pre>
  
  <p><strong>UPDATE</strong>. The following worked for me after modifying the upgrade entries:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"&gt;
  
    &lt;!--
  When creating a new install for the next version, these fields must be modified
  --&gt;
    &lt;?define ProductVersion = "2.0.4" ?&gt;
  
    &lt;?define ProductId64 = "*" ?&gt;
    &lt;?define ProductId32 = "*" ?&gt;
  
    &lt;?define PackageId   = "*" ?&gt;
  
  
    &lt;!-- Product name as you want it to appear in Add/Remove Programs--&gt;
    &lt;?if $(var.Platform) = x64 ?&gt;
    &lt;?define ProductName = "XYZ (64 bit)" ?&gt;
    &lt;?define Win64 = "yes" ?&gt;
    &lt;?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?&gt;
    &lt;?define ProductId = "$(var.ProductId64)" ?&gt;
    &lt;?define MainDllName = "XYZ64.dll" ?&gt;
    &lt;?define MainDllSource = "..\..\bin\Win64\Release\XYZ64.dll" ?&gt;
    &lt;?else ?&gt;
    &lt;?define ProductName = "XYZ (32 bit)" ?&gt;
    &lt;?define Win64 = "no" ?&gt;
    &lt;?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?&gt;
    &lt;?define ProductId = "$(var.ProductId32)" ?&gt;
    &lt;?define MainDllName = "XYZ.dll" ?&gt;
    &lt;?define MainDllSource = "..\..\bin\Win32\Release\XYZ.dll" ?&gt;
    &lt;?endif ?&gt;
  
  
    &lt;?define UpgradeCode = "{C3763742-7C1C-4AB7-A404-F030B7550E97}" ?&gt;
  
  
    &lt;Product
      Id="$(var.ProductId)"
      Name="$(var.ProductName)"
      Language="1033"
      Version="$(var.ProductVersion)"
      Manufacturer="Advanced Messaging Systems LLC"
      UpgradeCode="$(var.UpgradeCode)"
      &gt;
  
      &lt;Package Id="$(var.PackageId)"
               InstallerVersion="200"
               Compressed="yes"
               Description="XYZ Installer package"
               InstallPrivileges="elevated"
       /&gt;
  
      &lt;!-- No restore point  --&gt;
      &lt;Property Id="MSIFASTINSTALL" Value="3" /&gt;
  
  
      &lt;Upgrade Id="$(var.UpgradeCode)"&gt;
        &lt;UpgradeVersion Minimum="1.0.0"
                        IncludeMinimum="yes"
                        OnlyDetect="no"
                        Maximum="$(var.ProductVersion)"
                        IncludeMaximum="no"
                        Property="PREVIOUSFOUND" /&gt;
      &lt;/Upgrade&gt;
  
  
      &lt;Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /&gt;
  
      &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
        &lt;Directory Id="$(var.PlatformProgramFilesFolder)"&gt;
          &lt;Directory Id="INSTALLLOCATION" Name="XYZ"&gt;
  
            &lt;Component Id="XYZDll" Guid="E2CBEE41-6C0E-4A84-95C1-7282747B4A3D"&gt;
              &lt;File Id='MainDll' Name="$(var.MainDllName)" DiskId='1' Source="$(var.MainDllSource)" SelfRegCost="0" /&gt;
  
              &lt;!-- TODO: Insert files, registry keys, and other resources here. --&gt;
            &lt;/Component&gt;
  
          &lt;/Directory&gt;
        &lt;/Directory&gt;
      &lt;/Directory&gt;
  
      &lt;Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" /&gt;
  
      &lt;!-- Note: Custom actions to install/uninstall the dll using regsvr32.exe --&gt;
      &lt;CustomAction Id="RegisterDll"
                        Directory="INSTALLLOCATION"
                        ExeCommand='regsvr32.exe /s "[INSTALLLOCATION]$(var.MainDllName)"'
  
                        Return="check"&gt;
      &lt;/CustomAction&gt;
      &lt;CustomAction Id="UnregisterDll"
                    Directory="INSTALLLOCATION"
                    ExeCommand='regsvr32.exe /s /u "[INSTALLLOCATION]$(var.MainDllName)"'&gt;
      &lt;/CustomAction&gt;
  
  
      &lt;Feature Id="ProductFeature" Title="XYZ" Level="1"&gt;
        &lt;ComponentRef Id="XYZDll" /&gt;
        &lt;!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. --&gt;
        &lt;ComponentGroupRef Id="Product.Generated" /&gt;
      &lt;/Feature&gt;
  
      &lt;InstallUISequence&gt;
        &lt;Custom Action="WixCloseApplications" Before="AppSearch"/&gt;
      &lt;/InstallUISequence&gt;
  
      &lt;InstallExecuteSequence&gt;
  
       &lt;RemoveExistingProducts After="InstallInitialize"/&gt;
  
        &lt;SelfRegModules/&gt;
  
      &lt;/InstallExecuteSequence&gt;
  
      &lt;Icon Id="XYZ.ico" SourceFile="..\Graphics\XYZ.ico"/&gt;
      &lt;Property Id="ARPPRODUCTICON" Value="XYZ.ico" /&gt;
  
      &lt;!-- UI --&gt;
      &lt;UIRef Id="WixUI_InstallDir"/&gt;
      &lt;UIRef Id="WixUI_ErrorProgressText" /&gt;
  
      &lt;WixVariable Id="WixUILicenseRtf" Value="..\EULA\license.rtf" /&gt;
      &lt;WixVariable Id="WixUIBannerBmp"  Value="..\Graphics\banner.jpg" /&gt;
      &lt;WixVariable Id="WixUIDialogBmp"  Value="..\Graphics\logo.jpg" /&gt;
  
  
      &lt;!-- End UI --&gt;
    &lt;/Product&gt;
  &lt;/Wix&gt;
  </code></pre>