Pierre
Pierre

Reputation: 4416

WiX & DirectX: why am I getting "Invalid command line switch" error from dxsetup.exe?

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:

<CustomAction Id="Install_DirectX" FileKey="dxsetup.exe" ExeCommand="dxsetup.exe"
Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />

<Component Id="dxsetup.exe" Guid="*">
    <File Id="dxsetup.exe" Source="F:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Redist\DXSETUP.exe" KeyPath="yes" Checksum="yes"/>
</Component>

and executes:

<InstallExecuteSequence>
    <Custom Action="Install_DirectX" After="InstallFiles" >
        NOT REMOVE
    </Custom>
</InstallExecuteSequence>

When I run the compiled .MSI, I see a dialog box titled "DirectX" with the error:

Invalid command line switch

Nevertheless the installation completes normally: the program is installed and runs. Perhaps DirectX was already present on the target system.

Note that when I use this:

ExeCommand="dxsetup.exe /silent"

I get the same error message, but the installation fails and rolls back. The log file says:

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.

This happens before I even get prompted to launch the app. Besides, it only fails when I say ExeCommand="dxsetup.exe /silent", it does not apppear when ExeCommand="dxsetup.exe".

When DXSETUP is not invoked at all (commented out), the installation does not display an error message.

Orca shows this in the "Custom Action" section:

Action            Type   Source        Target
Install_DirectX   3154   dxsetup.exe   dxsetup.exe

In my old InstallShield script, when the command "dxsetup.exe /silent" was launched, it ran fine and did not display an error.

The installer is available here if you're curious (16MB): http://www.findyourfamilytree.com/exe/3DFT1.msi

I'm developing and installing on Windows 7, using WiX 3.7.

So, how can I get this to work?

Upvotes: 0

Views: 3405

Answers (1)

Erti-Chris Eelmaa
Erti-Chris Eelmaa

Reputation: 26268

ExeCommand should be the arguments that are passed to dxdiag.exe, not the actual command line, including dxdiag.exe.

What about this:

<CustomAction Id="Install_DirectX" FileKey="dxsetup.exe" ExeCommand="/silent"
Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />

ps, if it helped, don't be afraid to leave me positive feedback in odesk :-)

Upvotes: 1

Related Questions