views:

700

answers:

3

I'm using WiX, and would like to know the .wxs necessary to take a file and install it to every available sub-directory of a particular location. This could mean 0 or more final installation locations, determined at install time based on the currently existing directory structure. For example, if I started the install with:

\target
 \subdir-1
 \subdir-2

Then at the end of the installation my file would be in \subdir-1 and \subdir-2. If on the other hand these directories did not exist on the system when the install was started, my file would not be installed at all and no sub directories would be created.

+1  A: 

Afaik this is not possible with WiX (because it is basically against the nature of MSI to install a component into several locations).

You could either

  • create a different component for each subfolder, or
  • use a custom action to copy the component to all subfolders.

In the latter case you should also provide a corresponding CA for uninstallation which removes all the files from the subfolders again.

EDIT: Seems my above answer is not totally correct. MSI supports duplicating files using the DuplicateFile tables and WiX 3.0 also provides a mechanism called "smart cabbing". Both are mentioned in a blog post by Aaron Stebner.

0xA3
-> create a different component for each subfolder, orThis is not an option because we don't know the subfolders at compile time, and I assume we can't make components on the fly? I was hoping to avoid a custom action, seems too simple to require one.
Tomislav Mutak
+1  A: 

Not without a custom action, you need to write a custom action that will do that.
The latest and greatest in custom actions is the DTF (and here) framework that comes with Wix3.

Shay Erlichmen
+1  A: 

If you are targeting Vista (or Win2k8, not sure about Win2k3), you can use mklink.

leppie

related questions