English 中文(简体)
Writing upgradeable msi packages using WiX
原标题:
  • 时间:2009-12-03 14:12:07
  •  标签:
  • wix
  • nsis

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"/>
问题回答

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.





相关问题
3rd party Wix libraries

I am just getting started with Wix. I see there there a several libraries included with the default Wix install. I also see that users can create their own libraries(wixlibs). Are there any 3rd ...

Psake, Powershell & Wix

I have the below function as a part of my psake build. When the build is executing Candle.exe throws this error: candle.exe : warning CNDL1098: ext .BuildPackagesWixWebinWixIIsExtension.dll ...

wix custom dialog for config edit

hi i m trying make a setup msi for my application with wix v3 I have a problem about this task; I need a user input that will be stored in my application s config file (for example i need a dialog for ...

Closing an application using WiX

In creating my WiX installer I have run into an issue when trying to close an application before installing the upgrade. Below is an example of how I am attempting to do this. <util:...

Conditional uninstall of previous version in Wix

I m doing an installer for an software used for debugging embedded ARM cores (OpenOCD) and this installer automatically removes the previous versions - that s simple. However, sometimes that would be ...

热门标签