title: Wix Custom Action during installation failing
body: <p>I'm attempting to use a custom action to run a program with a command-line option during installation (after files copied).  The action requires admin permission (it sets up and installs a windows service).  For some reason, the custom action keeps failing.</p>
  
  <p>My wix code:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='Windows-1252'?&gt;
  &lt;Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'&gt;
  &lt;Product
  Name='WHS 2011 Media Collector'
  Id='28656223-C2E0-4E74-8503-B9D668056C4E'
  UpgradeCode='84F31832-4E09-4149-A3F7-56A8DF63086F'
  Language='1033'
  Codepage='1252'
  Version='3.0.0'
  Manufacturer='Nick Radtke'&gt;
  
  &lt;Package
    Id='*'
    Keywords='Installer'
    Platform="x64"
    Description="WHS 2011 Media Collector" Comments='Deployment Package for WHS 2011 Media Collector'
    Manufacturer='Nick Radtke'
    InstallerVersion='300'
    Languages='1033'
    Compressed='yes'
    SummaryCodepage='1252'
    InstallPrivileges='elevated'
    InstallScope='perMachine'/&gt;
  
  &lt;Media
    Id='1'
    Cabinet='WSSSampleAddins.cab'
    EmbedCab='yes'
    DiskPrompt="CD-ROM #1" /&gt;
  
  &lt;Property Id='DiskPrompt' Value="Addins Installation [1]" /&gt;
  &lt;Property Id="LaunchApplication" Value="&amp;quot;MediaCollectorServerService.exe&amp;quot; -install"/&gt;
  &lt;Property Id="MSIUSEREALADMINDETECTION" Value="1" /&gt;
  
  &lt;InstallExecuteSequence&gt;
    &lt;Custom Action='LaunchApplication' Before='InstallFinalize'&gt;NOT Installed&lt;/Custom&gt;
  &lt;/InstallExecuteSequence&gt;
  
  
  &lt;CustomAction Id="LaunchApplication"
                                  BinaryKey="WixCA"
                                  Impersonate="no"
                DllEntry="CAQuietExec64"
                Execute="deferred"
                Return="check"
                /&gt;
  
  &lt;Directory Id='TARGETDIR' Name='SourceDir'&gt;
    &lt;Directory Id='ProgramFiles64Folder' Name='PFiles'&gt;
      &lt;Directory Id="ParentAddinBinaryDir" Name="Nick Radtke"&gt;
        &lt;Directory Id="AddinBinaryDir" Name="WHS 2011 Media Collector"&gt;
          &lt;Component
            Id='WHS2011MCBinaryComponent'
            Guid='D21DA776-83F1-4F22-985B-FDB3C8ABD481'
            Win64='yes'&gt;
            &lt;RemoveFolder Id='AddinBinaryDir' On='uninstall' /&gt;
            &lt;File
              Id='WHS2011MediaCollector.ListViewSubTab'
              Name='WHS2011MediaCollector.ListViewSubTab.dll'
              DiskId='1'
              Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.ListViewSubTab.dll'
              ProcessorArchitecture='x64'
              KeyPath='yes'&gt;
            &lt;/File&gt;
            &lt;File
              Id='WHS2011MediaCollector.TopLevelTab'
              Name='WHS2011MediaCollector.TopLevelTab.dll'
              DiskId='1'
              Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.TopLevelTab.dll'
              ProcessorArchitecture='x64'
              KeyPath='no'&gt;
            &lt;/File&gt;
            &lt;File
              Id='WHS2011MediaCollector.PicturesSubTab'
              Name='WHS2011MediaCollector.PicturesSubTab.dll'
              DiskId='1'
              Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.PicturesSubTab.dll'
              ProcessorArchitecture='x64'
              KeyPath='no'&gt;
            &lt;/File&gt;
            &lt;File
              Id='WHS2011MediaCollector.VideosSubTab'
              Name='WHS2011MediaCollector.VideosSubTab.dll'
              DiskId='1'
              Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.VideosSubTab.dll'
              ProcessorArchitecture='x64'
              KeyPath='no'&gt;
            &lt;/File&gt;
            &lt;File
              Id='WHS2011MediaCollector.SettingsSubTab'
              Name='WHS2011MediaCollector.SettingsSubTab.dll'
              DiskId='1'
              Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.SettingsSubTab.dll'
              ProcessorArchitecture='x64'
              KeyPath='no'&gt;
            &lt;/File&gt;
            &lt;File
              Id='NetLibrary'
              Name='NetLibrary.dll'
              DiskId='1'
              Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\NetLibrary.dll'
              ProcessorArchitecture='x64'
              KeyPath='no'&gt;
            &lt;/File&gt;
            &lt;File
              Id='Icon.png'
              Name='Icon.png'
              DiskId='1'
              Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\Icon.png'
              ProcessorArchitecture='x64'
              KeyPath='no'&gt;
            &lt;/File&gt;
            &lt;File
              Id='taglib_sharp'
              Name='taglib-sharp.dll'
              DiskId='1'
              Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\taglib-sharp.dll'
              ProcessorArchitecture='x64'
              KeyPath='no'&gt;
            &lt;/File&gt;
            &lt;File
              Id='MediaCollectorServerService.exe'
              Name='MediaCollectorServerService.exe'
              DiskId='1'
              Source='..\..\MediaCollectorServerService\x64\Release\MediaCollectorServerService.exe'
              ProcessorArchitecture='x64'
              KeyPath='no'&gt;
            &lt;/File&gt;
          &lt;/Component&gt;
        &lt;/Directory&gt;
      &lt;/Directory&gt;
  
      &lt;Directory Id="WindowsServerDir" Name="Windows Server"&gt;
        &lt;Directory Id="WindowsServerBinDir" Name="Bin"&gt;
          &lt;Directory Id="WindowsServerAddinsDir" Name="Addins"&gt;
            &lt;Directory Id="WindowsServerPrimaryDir" Name="Primary"&gt;
              &lt;Component
                Id='WHS2011MCXMLComponent'
                Guid='D21DA776-83F1-4F22-985B-FDB3C8ABD491'
                Win64='yes'&gt;
                &lt;File Id='WHS2011MCTopLevelTabXML'
                  Name='WHS2011MediaCollector.addin'
                  DiskId='1'
                  Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.addin'
                  ProcessorArchitecture='x64'
                  KeyPath='yes'&gt;
                &lt;/File&gt;
              &lt;/Component&gt;
            &lt;/Directory&gt;
          &lt;/Directory&gt;
        &lt;/Directory&gt;
      &lt;/Directory&gt;
    &lt;/Directory&gt;
  &lt;/Directory&gt;
  
  &lt;Feature Id='Complete' Level='1'&gt;
    &lt;ComponentRef Id='WHS2011MCBinaryComponent' /&gt;
    &lt;ComponentRef Id='WHS2011MCXMLComponent' /&gt;
  &lt;/Feature&gt;
  &lt;/Product&gt;
  &lt;/Wix&gt;
  </code></pre>
  
  <p>This is the error I'm getting in the msi log:</p>
  
  <pre><code>MSI (s) (40:30) [22:58:07:647]: Created Custom Action Server with PID 11672 (0x2D98).
  MSI (s) (40:40) [22:58:07:663]: Running as a service.
  MSI (s) (40:40) [22:58:07:663]: Hello, I'm your 32bit Elevated custom action server.
  CAQuietExec64:  Error 0x80070002: Command failed to execute.
  CAQuietExec64:  Error 0x80070002: CAQuietExec64 Failed
  CustomAction LaunchApplication returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
  Action ended 22:58:07: InstallFinalize. Return value 3.
  MSI (s) (40:D0) [22:58:07:694]: Note: 1: 2265 2:  3: -2147287035 
  </code></pre>
  
  <p>If I run the command line as a normal user, it fails, but if I run it as an admin user (or the system user), it works.  I'm fairly certain the problem is the permissions on the action.  I've set it to deferred and Impersonate='no', but it's still not working.  Anyone have any tips?</p>
  
  <p>Edit: So, I've found that apparently shortcuts in launchapplication aren't working for the path of the executable.  Does anyone know the syntax that allows for this?</p>