3

I would like to run an executable file with a quiet execution custom action during the InstallUISequence phase.
This executable has a text file as a parameter. I don't want that text file to be installed and I can't put it on the directory/file part as it is intented to use during the UI sequence.
How can I do that?
Here is a sample code to explain what I want:

<CustomAction Id="RunIsql_cmd" Property="RunIsql" Value="&quot;[MYEXE]&quot; -U [PARAM1] -i **myFileFromThePackage.txt** Execute="immediate"/>
<CustomAction Id="RunIsql" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="check" Impersonate="no"/>

How can I define myFileFromThePackage.txt ?
I've tried to define the file like this:

<Binary Id="DummyFileForInstallOnly" SourceFile="myFile.txt" />

But I can't associate the id to the CA..

1 Answer 1

3

Adding it in Binary table is a good approach, but you also need to extract it during install in order to use it. This can be done through a custom action which uses the Windows Installer database API.

You will also need a custom action to delete the extracted file after it has been used.

Sign up to request clarification or add additional context in comments.

4 Comments

Great... Is there any method more simple than creating my own CA?
Yes. Use a different setup authoring which offers direct support for temporary files. This way you don't have to handle them yourself.
Finally I have created my own custom action to do the job
This answer was a good starting point, but it sent me on a wild goose chase how to call the API functions via P/Invoke. For installer newbies like me it's important to realize that you don't really have to make P/Invoke calls to the native API functions. The custom action can access the Binary table relatively simply via the MSI session object that gets passed to the custom action entry method. This SO answer shows the principle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.