Windows installer custom action error 1631
I'm creating msi-installer for a product and I need to launch web url in browser after installation. I use WIX 3.5 to create installer (but this probably doesn't important). The e开发者_开发问答xample I found in http://www.tramontana.co.hu/wix/lesson5.php#5.2 not work - installer log say's
"Action ended 15:27:30: LaunchBrowser. Return value 1631.".
I saw many posts about this problem in the internet but nobody provides solution (somebody found problem in multilanguage, somebody contacted Microsoft to solve that).
I can only guess that the problem is somewhere in security of Windows 7 (I encountered problem with it). Maybe windows installer is forbidden to launch exe-files (I tried many other examples with other exe-s but all had the same result).
Has anybody a general solution?
I suppose the problem was really with UAC security. To give a custom actinon administrative permissions we should make it deffered, like this:
<CustomAction Id="LaunchBrowser" Directory="TARGETDIR" Impersonate="no" Execute="deferred" ExeCommand="[BrowserExePath] [LaunchingUrl]" Return="check"/>
And I would highly recommend this blog post about custom actions - it completely changed my vision of them.
Here is what I did for both install and uninstall.
At first I also got "Return value 1631" and spent a lot of time with UAC security, elevating privileges, Impersonate="yes" and Execute="deferred" which didn't work.
But in the end it was fixed very simply when I correctly set Directory="TARGETDIR" rather than BinaryKey="WixCA"
<Product>
...
<CustomAction Id="LaunchBrowserInstall" Directory="TARGETDIR" Execute="immediate" Impersonate="yes" Return="asyncNoWait" ExeCommand="explorer.exe https://www.example.com/post_install/" />
<CustomAction Id="LaunchBrowserUninstall" Directory="TARGETDIR" Execute="immediate" Impersonate="yes" Return="asyncNoWait" ExeCommand="explorer.exe https://www.example.com/post_uninstall/" />
<InstallExecuteSequence>
<Custom Action="LaunchBrowserInstall" After="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
<Custom Action="LaunchBrowserUninstall" After="InstallFinalize">REMOVE ~= "ALL"</Custom>
</InstallExecuteSequence>
...
</Product>
精彩评论