A type 2 custom action runs an executable, and the executable is stored in the Binary table/stream. The CustomAction Element documentation and the MSDN documentation are very helpful.
| BinaryKey | The Id of an entry in the binary table | ExeCommand | The command line arguments |
The EXE is actually stored in the binary table, and if the EXE is unusually large this will have a considerable impact on the resulting .MSI size.
The EXE should not depend upon any external DLLs or other EXEs other than system DLLs, and even then these should only be ones that are common to all operating systems.
The "ExeCommand" attribute specifies the command line arguments.
<!--
Copy an EXE into the binary table
-->
<Binary
Id="SampleEXE"
SourceFile="CustomActions\Sample.exe" />
<!--
Define the custom action
-->
<CustomAction
Id="SampleExe"
BinaryKey="SampleExe"
ExeCommand="-CommandLine Switches -Go Here" />
<!--
Invoke the custom action
-->
<InstallExecuteSequence>
<Custom
Action="SampleExe"
After="AppSearch" />
</InstallExecuteSequence>