In WiX, how to create a temporary hidden folder (Like SUPPORTDIR In IS)on the target machine,during installation and how to add the files to it, that are stored in the Binary table, and then subsequently delete it after Installation is completed in wix?
Grateful to any help.
Thanks.
This is a sample solution that extends the idea I referenced in my own comment.
To tell it short, you don't have to complicate the solution by adding extra files to the binary table, extract them in a custom action and remove afterwards. The built-in mechanism on DTF custom actions does it for you.
Let's say you have an XML file you'd like to read in the custom action to output some info to the installation log file. First of all, you should create a Custom Action project in VS (File -> New -> Project... and choose "C# Custom Action project" template).
Then, add an XML file as a content: right-click the project in the Solution Explorer, choose Add -> New Item... and select XML file. Let's call it
data.xml
. The contents might look like this:Next, add some code to read the values from this XML and write something to the installation log (remember, it's just a sample):
Note that I reference the XML file as just
data.xml
- when custom action runs, it will find the file in the same directory it runs from.Finally, add your custom action to the installation process:
Now, build the MSI package and run the installation the following way:
When the package installation completes, open the
install.log
file and search forCustomActions.ReadXml
. You'll see something like this:Obviously, custom action has done its job: it read the XML file contents and output proper info to the log file. One more thing to note: the temp directory path. Try to navigate to that directory - you'll find out that it is empty.
This means DTF took care about extracting files to the proper location to make it available for the custom action code, and cleaning up after the job is done.
Hope this overview helps understanding the way it works.