WiX custom action - running application in Target directory

briler picture briler · Jan 18, 2012 · Viewed 7.3k times · Source

I am using WiX to install a certain EXE file. I want the WiX setup to end running the EXE file (and not leaving any window opened), so I am using:

<CustomAction Id="LaunchApp" FileKey="APPFileKey" ExeCommand="" Return="asyncNoWait" Impersonate="no" />

The only issue is that it runs the application with current directory being the place where I run the MSI.

And I need this application to be running where the user choose to install it - it causes me many issues. Is it possible to tell WiX where to run the custom action?

Answer

cosmin picture cosmin · Jan 19, 2012

You can use the Directory attribute of CustomAction to specify a working directory.

It doesn't work with FileKey, but it works with ExeCommand. Instead of FileKey, you can set ExeCommand to something like "[TARGETDIR]file.exe".