Using WiX, how to install one file in (potentially) several subdirectories based on what is available during installation?

I am using WiX and would like to know the .wxs needed to take the file and install it in any available subdirectory of a specific location. This may mean 0 or more installation endpoints determined during installation based on an existing directory structure. For example, if I started the installation with:

\target \subdir-1 \subdir-2 

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

+4
source share
3 answers

Afaik is not possible with WiX (because it is basically against the nature of MSI for installing a component in multiple locations).

You can either

  • create another component for each subfolder or
  • use an arbitrary action to copy the component to all subfolders.

In the latter case, you must also provide the appropriate CA for deletion, which again deletes all files from the subfolders.

EDIT: It seems my answer above is not entirely correct. MSI supports file duplication using DuplicateFile tables, and WiX 3.0 also provides a mechanism called smart cabbing . Both are mentioned in Aaron Stebner's blog post.

+3
source

Not without a special action, you need to write a custom action that will do this.
The last and greatest in user actions is DTF ( and here ), which comes with Wix3.

+1
source

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

+1
source

All Articles