Wix Installer Execute Program after installation f

2019-08-09 04:19发布

问题:

I have looked at all the SO questions and a range of others, and cannot find the answer.

I have an executable to run after an installation:

<Property Id="WixShellExecTarget" Value="#filUpgrader" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="no" />

which is always run after installation (no checkbox needed)

<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">1</Publish>

I have tried every option I can think to make this work (it was impersonating in a previous incarnation). Whatever I do, it seems to give me this:

Action 14:30:46: LaunchApplication. 
Action start 14:30:46: LaunchApplication.
MSI (c) (38:0C) [14:30:47:026]: Invoking remote custom action. DLL: ***********\AppData\Local\Temp\MSI395.tmp, Entrypoint: WixShellExec
Action ended 14:30:47: LaunchApplication. Return value 3.
MSI (c) (38:E4) [14:30:47:111]: Note: 1: 2205 2:  3: Error 
MSI (c) (38:E4) [14:30:47:123]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 2896 
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 14:30:47: ExitDialog. Return value 3.

(I have starred out local file paths).I thought the problem was that it wanted elevated privileges, but that is not the case any more. When I run the app from the installed directory, it runs fine, without asking for admin permission or anything else.

This is starting to really annoy me. I have another installation with the same issue, but this is the more straightforward of them. If I can get this working, I should be able to sort the other one out. But I am starting to lose faith in Wix.

回答1:

If that value is supposed to refer to a file, it needs to be in square brackets so it resolves to the actual path, as in the docs example here, step 3:

http://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/run_program_after_install.html

and hopefully that is one of the files you're installing.



标签: wix