WiX Burn: LaunchTarget fails with error 0x80070002

2019-06-03 15:28发布

问题:

Setting LaunchTarget e.g. to "cmd.exe" works fine, after the installation of the burn package, the desired command line window pops up. However, setting LaunchTarget to for example "[InstallFolder]\Path\To\Postinstallexecutable.exe" yields an error:

Error 0x80070002: Failed to launch target: C:\Program Files (x86)\Path\To\Postinstallexecutable.exe

The path is correct, executing "C:\Program Files (x86)\Path\To\Postinstallexecutable.exe" at the command line works fine. Is this a bug or am I missing something? WiX toolset version is 3.8.309.0.

Update: After a little more testing, the problem seems to occur only when you try to pass a parameter to the command in LaunchTarget. So for example using

<Variable Name="LaunchTarget" Value="[InstallFolder]\Basiskomponenten\Allgemein\test.cmd" />

works, while

<Variable Name="LaunchTarget" Value="[InstallFolder]\Basiskomponenten\Allgemein\test.cmd Test123" />

results in an 0x80070002 error.

回答1:

The LaunchTarget variable points only to the executable that should be launched, it cannot be provided the command-line arguments. It wasn't until a very recent build of WiX v3.8 that you could set a second variable called LaunchArguments that provides the arguments. So, try upgrading to yesterday's WiX v3.8 build (or newer) and do:

<Variable Name="LaunchTarget" Value="[InstallFolder]\Basiskomponenten\Allgemein\test.cmd" />
<Variable Name="LaunchArguments" Value="Test123" />


标签: wix burn