views:

566

answers:

3

We've gotten a custom action that runs command-line to work as such:

<CustomAction Id="OurAction" FileKey="OurInstalledExe.exe" ExeCommand="our command line args" Execute="deferred" Return="check" />

The problem is, the user sees a console popup when the command runs.

The command line requires UAC elevation, but should not require any user interaction. We also install the file with the setup, the custom action runs After="InstallFiles".

How do we prevent the user from seeing the console?

+1  A: 

If you have the source code of the exe this is what you can do. Make the EXE project Win32 Application project instead of Console Application.

If you cannot modify the Source code of the Exe, You can do this by:

  1. Create a CustomAction dll
  2. Call a CustomAction in DLL (From Wix) to Execute the process, by hiding the console window.
SysAdmin
We have no access to the source code of the process, we'd have written a custom action otherwise. Is this the only way? This seems like a no-brainer setting that WiX should have. Why should I have to write a custom action to start a process?
Jonathan.Peppers
+3  A: 

This should help you: http://wix.sourceforge.net/manual-wix3/qtexec.htm

Yan Sklyarenko
Although they made this part of Wix kind of convoluted, it is exactly what we were looking for.
Jonathan.Peppers
+1  A: 

Note that if you do require UAC elevation, then you need to ensure that it's a deferred execution CA. Here's the example from the manual with command line arguments added.

<CustomAction Id="QtExecDeferredExampleWithProperty_Cmd" Property="QtExecDeferredExampleWithProperty"
              Value="&quot;[#MyExecutable.exe]&quot; /arguments" Execute="immediate"/>
<CustomAction Id="QtExecDeferredExampleWithProperty" BinaryKey="WixCA" DllEntry="CAQuietExec"
              Execute="deferred" Return="check" Impersonate="no"/>
.
.
.
<InstallExecuteSequence>
    <Custom Action="QtExecDeferredExampleWithProperty_Cmd" After="CostFinalize"/>
    <Custom Action="QtExecDeferredExampleWithProperty" After="TheActionYouWantItAfter"/>
</InstallExecuteSequence>
sascha
Thanks, we're already doing this.
Jonathan.Peppers