I am new user of WiX. In installer which I am trying to develop, I need install files to some existing subfolders of C:\Users\Public\Documents. So my questions are:
1. How to check in wix if directory C:\Users\Public\Documents\myFolder exists?
2. How to write tell Wix to install files to this location.
Thank you in advance.
You can use WIX_DIR_COMMON_DOCUMENTS (OSInfo custom actions) to ship the files into Public Documents folder. Inside the TARGETDIR use the below code to ship the files.
<Directory Id="WIX_DIR_COMMON_DOCUMENTS">
<Directory Id="SampleFolder" Name="myFolder">
<Component Id="CMP_myFolder" Guid="{YOUR_GUID_HERE}">
<File Id="File_Test" Source="Test.txt" KeyPath="yes" />
</Component>
</Directory>
</Directory>
You can use DirectorySearch element to check the Directory is exists or not. But you can’t use the WIX_DIR_COMMON_DOCUMENTS along with DirectorySearch element, since DirectorySearch is running in AppSearch action and OSInfo custom actions are run after AppSearch. So you need to write a Custom action to read the Public Documents folder.