简体   繁体   中英

WiX— check for a previous installation

I've got a legacy application that's installed directly to the user's c: drive, in a directory (like c:\MyApp). Nasty stuff. Problem is, the user can specify to have a second installation on a second drive (like e:\MyApp), and they can have two different versions of the application installed at once in either directory. They can also decide to install the app elsewhere in the directory tree, but those are the two most common locations.

I did not write this scheme. It makes baby Jesus cry, as far as I'm concerned.

I have to write an installer to add a module to this scheme, and the user needs to be able to select which installation they want to install the module on. I thought I'd try this in WiX.

How do I do this?

I was going to do a directory search like

<Property Id="MyAppInstallationSearch">
  <DirectorySearch Id="MyAppDirectory" Path="C:\MyApp">
  </DirectorySearch>
</Property>

and then:

<Directory Id="TARGETDIR" Name="MyAppInstallationSearch">
    <Directory Id="INSTALLLOCATION" Name="AdditionalTools">
    </Directory>
</Directory>

to have an installation location.

So how do I:

  1. Make that search be relative, not absolute? (the documentation specifies that this can be done, I just don't see how).

  2. If the user has multiple locations, give them a choice of which installation to use?

  1. It will be relative meaning, AdditionalTools will be under the folder found by MyAppInstallationSearch.
  2. This will involve creating UI, which is not an easy thing in Wix, there are products that can create Wix output or WixEdit . You will need to search the directory on all possible places and show the user radio buttons (each bounded to a search results) to selected where to install the the new prodcut.

I had to implement the same thing and I used an external UI handler to completly customize the installation process. I also display a wizard page where the user can select the version he wants to upgrade from. But be aware that this isn't something you can do within a day or two.

I don't know which programming language you use, but if you want to use .NET you can the Development Tools Foundation included with Wix3. The libraries can be found in the SDK folder of your Wix installation (you'll mainly need Microsoft.Deployment.WindowsInstaller.dll), documentation is in the DTF.chm in the doc directory. You'll also need a bootstrapper to install the .NET framework.

You could also wait until Wix 3.5, which will include Burn, a boostrapper and external UI handler you can easily customize.

HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM