Search code examples
visual-studio-2012wixwindows-installer

Wix to replace installations from Visual Studio installers


I had an old installer which was a basic visual studio setup project and now it has been replaced by a WIX installer. The new Wix installer works fine, expect the necessity I have.

Many clients were installed with the old one and now, at next version of our product we need to use this Wix installer.

I need the Wix installer to replace the old installation without uninstalling the previous version through control panel.

I have tried putting the same Product Code as before, also changing the Upgrade Code and it doen't work.

Does anyone know whether is possible to replace installations from VS Installers with Wix Installers?

Wix

<?define Product.UpgradeCode = "{60DA573D-4C8A-48CA-ADA5-9C130A7100E8}" ?>
<?define Product.ProductCode = "{1A65C362-E880-4F2A-ADEF-B1D83A87C914}" ?>

<Product Id="$(var.Product.ProductCode)"
           Name="My Application"
           Language="1033"
           Version="$(var.REVISION)"
           Manufacturer="My Manufacturer"
           UpgradeCode="$(var.Product.UpgradeCode)">
           ...
           ...
<MajorUpgrade Schedule="afterInstallInitialize" 
  DowngradeErrorMessage="A later version of MY PRODUCT is already installed." />

<Upgrade Id="$(var.Product.UpgradeCode)">
<UpgradeVersion Minimum="$(var.BUILD)" 
    IncludeMinimum="no" OnlyDetect="yes" 
    Property="NEWERVERSIONDETECTED" />
  <UpgradeVersion Maximum="$(var.PREVBUILD)" 
   IncludeMaximum="yes" OnlyDetect="no" 
   Property="OLDERVERSIONBEINGUPGRADED" />
</Upgrade>

Error Message

Error


Solution

  • That error message means your ProductCode hasn't changed. You want the UpgradeCode to be the same but you want the ProductCode to be unique with each build. To achieve this you set it to "*" and the compiler will gen one at build time.

    If you then install but get 2 entries in Add Remove Programs, that would mean you have a problem with your MajorUpgrade rule.