title: WiX & DirectX: why am I getting "Invalid command line switch" error from dxsetup.exe?
body: <p>I am creating a WiX install script that includes DirectX 9 (June 2010) components. Many of my users still use XP. The WiX script defines:</p>
  
  <pre><code>&lt;CustomAction Id="Install_DirectX" FileKey="dxsetup.exe" ExeCommand="dxsetup.exe"
  Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" /&gt;
  
  &lt;Component Id="dxsetup.exe" Guid="*"&gt;
      &lt;File Id="dxsetup.exe" Source="F:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Redist\DXSETUP.exe" KeyPath="yes" Checksum="yes"/&gt;
  &lt;/Component&gt;
  </code></pre>
  
  <p>and executes:</p>
  
  <pre><code>&lt;InstallExecuteSequence&gt;
      &lt;Custom Action="Install_DirectX" After="InstallFiles" &gt;
          NOT REMOVE
      &lt;/Custom&gt;
  &lt;/InstallExecuteSequence&gt;
  </code></pre>
  
  <p>When I run the compiled .MSI, I see a dialog box titled "DirectX" with the error:</p>
  
  <blockquote>
    <p><strong>Invalid command line switch</strong></p>
  </blockquote>
  
  <p>Nevertheless the installation completes normally: the program is installed and runs. Perhaps DirectX was already present on the target system.</p>
  
  <p>Note that when I use this:</p>
  
  <pre><code>ExeCommand="dxsetup.exe /silent"
  </code></pre>
  
  <p>I get the same error message, but the installation fails and rolls back. The log file says:</p>
  
  <pre><code>Action 19:29:27: Install_DirectX. 
  Action start 19:29:27: Install_DirectX.
  Install_DirectX: 
  Action ended 19:29:27: Install_DirectX. Return value 1.
  (...)
  Action 19:29:29: Install_DirectX. 
  CustomAction Install_DirectX returned actual error code -9 but will be translated to success due to continue marking
  (...)
  Action 19:29:39: LaunchApplication. 
  Action start 19:29:39: LaunchApplication.
  Action ended 19:29:39: LaunchApplication. Return value 3.
  DEBUG: Error 2896:  Executing action LaunchApplication failed.
  The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896. The arguments are: LaunchApplication, , 
  Action ended 19:29:39: ExitDialog. Return value 3.
  Action ended 19:29:39: INSTALL. Return value 1.
  === Logging stopped: 01-Dec-2014  19:29:39 ===
  MSI (c) (A8:D4) [19:29:39:581]: Product: 3D Family Tree -- Installation completed successfully.
  </code></pre>
  
  <p>This happens before I even get prompted to launch the app. Besides, it only fails when I say <code>ExeCommand="dxsetup.exe /silent"</code>, it does not apppear when <code>ExeCommand="dxsetup.exe"</code>.</p>
  
  <p>When DXSETUP is not invoked at all (commented out), the installation does not display an error message.</p>
  
  <p>Orca shows this in the "Custom Action" section:</p>
  
  <pre><code>Action            Type   Source        Target
  Install_DirectX   3154   dxsetup.exe   dxsetup.exe
  </code></pre>
  
  <p>In my old InstallShield script, when the command "dxsetup.exe /silent" was launched, it ran fine and did not display an error.</p>
  
  <p>The installer is available here if you're curious (16MB):
  <a href="http://www.findyourfamilytree.com/exe/3DFT1.msi" rel="nofollow">http://www.findyourfamilytree.com/exe/3DFT1.msi</a></p>
  
  <p>I'm developing and installing on Windows 7, using WiX 3.7.</p>
  
  <p>So, how can I get this to work?</p>