views:

122

answers:

2

I am using WIX and have successfully used a custom action to execute installed file at the end of installer like this:

<CustomAction Id="LaunchAfterInstall" FileKey="foobar.exe" ExeCommand="parameters" Execute="immediate" Impersonate="yes" Return="asyncNoWait" />

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION"/>

<UIRef Id="WixUI_InstallDir" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch Foobar." />
<UI>
    <Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchAfterInstall">WIXUI_EXITDIALOGOPTIONALCHECKBOX</Publish>
</UI>

This works well when foobar.exe is in a component in the same wxs file. However what I really want is to execute a file that is installed by a merge module. How do I do this?

I can make changes in the merge module, if this helps things.

A: 

I changed the action to solve my problem:

<CustomAction Id="LaunchAfterInstall" Directory="INSTALLLOCATION" ExeCommand="[INSTALLLOCATION]\foobar.exe" Execute="immediate" Impersonate="yes" Return="asyncNoWait" />
Juozas Kontvainis
A: 

You can also open the Merge Module in Orca or your MSI after the build is complete (i.e. the Merge Module has been merged in) and look up the File.Id. Then use the File.Id in the CustomAction.

Ideally though the MSI shouldn't refer to content inside the Merge Module since Merge Modules are supposed to be independent. I appreciate it doesn't always work out that way. :)

Rob Mensching
This did not work. I tried to access file using "decorated" (with the GUID in the end, copied from Orca) file id, I tried moving action to merge module and then reference that action using "decorated" id, but WIX compiler did not cooperate.
Juozas Kontvainis
If you put the action in the Merge Module then you don't add it decorated. The compiler will do that for you.
Rob Mensching