1

I have a working WiX 3.5 installer. After successful install, I know how to get WiX to launch the application that has just been installed.

However, I also want to ship my install CD with a small application that runs from the CD itself - and I'd like this to pop up at the end of the main application install. It's important that the second application runs from the CD.

My first attempt - which launched the primary application at the end of the install - is this:

<UI>
    <!--  <UIRef Id="WixUI_Minimal" />  -->
    <Publish Dialog="ExitDialog"
             Control="Finish"
             Event="DoAction"
             Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch MyInstalledApp" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />

<Property Id="WixShellExecTarget" Value="[#MyInstalledApp.exe]" />
<CustomAction Id="LaunchApplication"
    BinaryKey="WixCA"
    DllEntry="WixShellExec"
    Impersonate="yes" />

However, I want to change this to launch something like "D:\MyTinyApp.exe" instead. How do I address the source CD using WiX?

1 Answer 1

2

Give this a shot. Assuming the file that you want to execute is in the same location that the MSI file was, you have to go find it first:

<Property Id='WixShellExecTarget'>
    <DirectorySearch Id='DirSearch' Path='[SOURCEDIR]' Depth='0'>
        <FileSearch Id='FileSearch' Name='MyFileToRun.exe'/>
    </DirectorySearch>
</Property>
<CustomAction Id="LaunchApplication"
    BinaryKey="WixCA"
    DllEntry="WixShellExec"
    Impersonate="yes" />

The [SourceDir] is the key. It should be where the MSI is. You might consider adding a condition as well to do something useful if the file can't be found.

1
  • Thanks for that, and sorry for delay in replying. If I try this code I get "The Property/@Id attribute's value, 'WixShellExecTarget', cannot contain lowercase characters. Since this is a search property, it must also be a public property. This means the Property/@Id value must be completely uppercase." But if I change Id and everything else to uppercase, it gives the same error. Any ideas?
    – Sugrue
    Jun 1, 2012 at 14:47

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.