tags:

views:

312

answers:

1

I am writing a installer for an existing product, for which an earlier installer was written in NSIS (Nullsoft Scriptable Install System). I have to write an msi based installer for this product using WiX. I have certain question regarding this :-

  1. How to detect whether my application is installed or not on a target machine? The application may have been installed using NSIS (older versions) or MSI (now onwards).
  2. How to write a WiX installer which can upgrade if there is older/same version of product installed on target machine. I found this topic on several sites but all those are not working. Specifically I want to know which information (GUID, version etc.) needs to be changed in the installer code base on each release of the software.
  3. Three/four versions of our product are released each year. What kind of installer will be best suitable for me?

Please note that if I just change version of the product element in Wix code, then the newer installer is not able to replace the older one. When I double click the newer version of the installer it shows an error dialog saying

Another version of this product is already installed. Installation of this version cannot continue.To configure or remove the existing version of this product, use Add/Remove Programs on the Control panel".

Sample code:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" >
   <Product Name='Baton' Id='41B8F929-B6CF-41BE-9E40-C96D9BD6D672'
       UpgradeCode='E1F03FA4-D470-4FA6-86BA-F5CDD3007C1D'
       Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Company Name.'>

       <Package Id='*' Keywords='Installer' Description="product Installer"
           Comments='product comments'
           InstallerVersion='100' Languages='1033' Compressed='yes'
           SummaryCodepage='1252' />

       <Upgrade Id='E1F03FA4-D470-4FA6-86BA-F5CDD3007C1D'>
           <UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND' Minimum='1.0.0'
               IncludeMinimum='yes' Maximum='1.1.0' IncludeMaximum='yes' />
       </Upgrade>

       <!-- ***Install execution sequence*** -->
       <InstallExecuteSequence>
           <RemoveExistingProducts After="InstallInitialize"/>
A: 

Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control panel.

This is the error you get when you rebuild your installer with the exact same product ID and then run it again. To avoid this, set the product element id to Id="*".

Major upgrades can be implemented as in this answer. It does about the same as your sample code, except that it makes use of preprocessor variables to keep the version consistent between the Product element and the UpgradeVersion element. It also prevents downgrades.

Wim Coenen