Search code examples
wixwindows-installerwix3

WIX installer: Use property value to place a file


I've read a property from the registry, and that property has been set properly (I'm using this to check the property value)

<CustomAction Id="Test" Script="vbscript">
   <![CDATA[MsgBox Session.Property("MYEXTRAFILESFOLDER")]]>
</CustomAction>

Now I'm just trying to drop a few files into that folder. I can't figure out how to make a File element target a specific directory.


Solution

  • As I get you don't need to change taget path in general but only put some files to specific folder. Easiest way is to create custom action.

    1. Add custom action as described
    2. In InstallExecuteSequence set After=InstallFiles or After=InstallFinalize (to make sure that your files from installer will be copied already)
    3. In custom action read you path from registry
    4. Get you install path using TARGETDIR
    5. Move files from TargetDir to your registry dir

    Another option is

    1. Create custom action as described
    2. In custom action read you path from registry
    3. Get file stream from installer and write it to folder

    Also this can be an option too. But I don't know how it works exactly