Question

I`m having some trouble trying to modifying an sql script, marked in wix as Binary file. Basically, what I want to do is read the file (binary file as it is declared), replace some values in it based on properties set in wix, and save the file, then run it as an sql script. What I have tried so far: Getting the target directory with session.GetTargetPath("TARGETDIR"), but it returns me with wrong path, not the one where the script is initially extracted(such as a temporary folder) so i can modify it, then save it and make sure it will run the modified script. My question is: HOW can I get the path of a binary file at installation step, or how can I access it via session or w/e?

To mention: I have tried declaring it as a file, and later I can not run it as an sql script, cause it requires a binary, not a file.

Thanks!

Was it helpful?

Solution

You can use the formatted string format for entries in the file-table, i.e. [#filekey] to get the full path of the file. You should then be able to either set a property / CustomActionData-property and read it within a VBSScript. Please note also the following (extract from the linked page):

 The value of [#filekey] remains blank and is not replaced by a path until the installer runs the CostInitialize action, FileCost action, and CostFinalize action.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top