tags:

views:

866

answers:

3

Hi all,

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  A: 
  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.
Shay Erlichmen
OK, but how do I even find the results in the first place?
mmr
Find as in see in the logs? can you rephrase the question?
Shay Erlichmen
The results of the search get stored somewhere, right? Where? How do I access them? And how do I specify 'search this whole computer'?
mmr
I think that I will be best if you write a VBS that will search the drives. MSI doesn't know how to do multiple file search. it will stop on the 1st one it will find.
Shay Erlichmen
I believe you can't use a script that hasn't already been installed.
mmr
Nope, you can use script that are embedded in the setup or going to be installed by the setup.
Shay Erlichmen
+1  A: 

Try this link that seems to have some information on various ways to detect previous installations

Conrad
A: 

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

Simon