wixwindows-installersetup-projectorcavisual-studio-setup-proje

Folder property of File Search Launch Condition: how to specify custom folder under [TARGETDIR]?


I'm trying to set a file search launch condition for my installer. I need it to search for a specified file in a subfolder of my [TARGETDIR] folder.

I tried setting the Folder property to:

None of the above solutions worked. The file located in subfolder never gets found. It works if I only specify [TARGETDIR] with the Depth property set to 1, but I would rather specify directly the directory to search.

I found a similar question here, but there is no answer.

What is the correct way to set the Folder property to work with a custom folder ?


Solution

  • The difficulty here is that TARGETDIR is not set until later than the search is done, so it has no value yet. Even if if it did have a value, it's what is changed by the browse dialog that can change where the user installs thet app (see the property window of Application Folder in File System on Target Machine).

    This means you must use standard folder properties in your search. If you want to search what you think may be where the file is installed, then use:

    [ProgramFilesFolder]SomeFolder\SomeOtherFolder

    or something similar if your assumed value of TARGETDIR is in Program Files x86.