<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx</link><description>How to suppress console windows for EXE custom actions.</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#516526</link><pubDate>Tue, 24 Jan 2006 03:29:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:516526</guid><dc:creator>C++ guy</dc:creator><description>From the msdn docs for Process Creation Flags:&lt;br&gt;&lt;br&gt;CREATE_NO_WINDOW&lt;br&gt;0x08000000 	This flag is ignored.</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#516533</link><pubDate>Tue, 24 Jan 2006 03:45:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:516533</guid><dc:creator>Heath Stewart</dc:creator><description>That's interesting. Both WiX and the .NET Framework via System.Diagnostics.Process.Start() use the CREATE_NO_WINDOW flag. Sounds like a documentation bug. I will look into it.</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#517513</link><pubDate>Wed, 25 Jan 2006 21:36:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:517513</guid><dc:creator>Heath Stewart</dc:creator><description>In MSDN Online in &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/library/en-us/dllproc/base/process_creation_flags.asp"&gt;http://msdn.microsoft.com/library/en-us/dllproc/base/process_creation_flags.asp&lt;/a&gt; it does indeed say that the flag is ignored, but in local MSDN content like that installed with the Platform SDK it says the flag is ignored under 9x. It is used under NT. I am working with the kernel team to make sure this gets updated.&lt;br&gt;&lt;br&gt;In 9x you can't hide a console, it's true, which is why you should run under the Windows subsystem.</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#518129</link><pubDate>Fri, 27 Jan 2006 04:23:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:518129</guid><dc:creator>C++ guy</dc:creator><description>Thanks for the thorough investigation.  I've been wondering about this flag for a while...</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#524373</link><pubDate>Sat, 04 Feb 2006 00:02:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:524373</guid><dc:creator>Madnad</dc:creator><description>What about if you want to run a built in command like net.exe or sc.exe? I'm using WiX's CAQuietExec, but get an error 0x80070002 in the log when the command runs.</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#524397</link><pubDate>Sat, 04 Feb 2006 00:23:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:524397</guid><dc:creator>Heath Stewart</dc:creator><description>Madnad, HRESULT 0x80070002 is a Win32 error (uses FACILITY_WIN32) for ERROR_FILE_NOT_FOUND. The command you're running doesn't specify the appropriate path to executables such as net.exe or sc.exe. Are you specify a full path and if so are you using folder properties like [SystemFolder]net.exe?</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#524557</link><pubDate>Sat, 04 Feb 2006 03:18:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:524557</guid><dc:creator>Madnad</dc:creator><description>heaths, yes I am using exactly what you specify: here's a snippet: 
&lt;p style="FONT-FAMILY: courier new, monospace"&gt;&amp;lt;CustomAction id=startsvc.command Value="[SystemFolder]net.exe start myservice" Property="QtExecCmdLine" /&amp;gt;&lt;br/&gt;&amp;lt;CustomAction id=startsvc Return="check" Execute="immediate" DllEntry="CAQuietExec" BinaryKey="wixca" /&amp;gt;&lt;br/&gt;...&lt;br/&gt;&amp;lt;Custom After="InstallInitialize" Action="startsvc.command"&amp;gt;NOT Installed&amp;lt;/CUSTOM&amp;gt;&lt;br/&gt;&amp;lt;Custom After="startsvc.command" Action="startsvc"&amp;gt;NOT Installed&amp;lt;/Custom&amp;gt;&lt;/p&gt;</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#524587</link><pubDate>Sat, 04 Feb 2006 04:22:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:524587</guid><dc:creator>Heath Stewart</dc:creator><description>&lt;p&gt;Madnad, there's several things wrong with that snippet.&lt;/p&gt;
&lt;p&gt;First, if you're installing a service you should use both the ServiceInstall and ServiceControl tables not a custom solution with a command-line like this. It presents serviceability problems where if you use the ServiceInstall and ServiceControl tables you can properly reinstall and patch your service.&lt;/p&gt;
&lt;p&gt;Second, immediate CAs should never modify system state.&lt;/p&gt;
&lt;p&gt;Third, you scheduled your immediate CA after InstallInitialize. The file hasn't even been installed yet. InstallFiles is a deferred standard action that only gets scheduled between InstallInitialize and InstallFinalize and doesn't get processed until after InstallFinalize or any occurance of InstallExecute or InstallExecuteAgain. Windows error 2 would happen if the service doesn't exist. Try this: go to a machine where your product or service isn't installed and type "net start myservice". Now type "echo %errorlevel%" and you'll see 2 returned - the same error as you got back from the MSI custom action server in your log (wrapped in an HRESULT using the FACILITY_WIN32 (7) facility).&lt;/p&gt;
&lt;p&gt;I highly recommend that you read all of the topic "Custom Actions" at &lt;a href="http://msdn.microsoft.com/library/en-us/msi/setup/custom_actions.asp"&gt;http://msdn.microsoft.com/library/en-us/msi/setup/custom_actions.asp&lt;/a&gt; and child topics. For WiX information see &lt;a href="http://wix.sourceforge.net"&gt;http://wix.sourceforge.net&lt;/a&gt;. Look up the &amp;lt;ServiceInstall&amp;gt; and &amp;lt;ServiceControl&amp;gt; elements. Using these will schedule everything correctly and will help produce a more serviceable MSI.&lt;/p&gt;</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#524598</link><pubDate>Sat, 04 Feb 2006 04:40:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:524598</guid><dc:creator>Madnad</dc:creator><description>heaths, problem is i'm trying to start a driver that i'm going to be installing (type = kernel). &lt;ServiceInstall&gt; does not handle this, so i am using "sc create" to register the driver and "net start" to start it up. It all works when i do it using standard CA's, but a command window pops up which is ugly. I'm simply trying to do it without popping up a command window. 
I'll read the MSI topics mentioned and play around with the scheduling and immediate/deferred. I'm on a very tight deadline (tomorrow) so any extra help will be appreciated.  

</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#524602</link><pubDate>Sat, 04 Feb 2006 04:48:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:524602</guid><dc:creator>Heath Stewart</dc:creator><description>If it's a kernel driver then yes, as you said, it's not supported using the ServiceInstall table.&lt;br/&gt;&lt;br/&gt;Still, you're CAs must be deferred CAs that run after the service is installed. You can't start a service before it's installed and it won't be installed until after the standard InstallFiles action is processed, which actually won't be until after InstallFinalize (since it's a deferred CA).&lt;br/&gt;&lt;br/&gt;Finally, the other problem I meant to mention last time (sorry) was that the Id of the property you set must be the same as the name of the custom action or be set immediately preceding the CA as the CustomActionData property. So, the propery should actually be set to &amp;quot;startsvc&amp;quot; since that's what your other CA is called, or use the property &amp;quot;CustomActionData&amp;quot; but make sure no other CA sneaks in between those two scheduled actions in your InstallExecuteSequence table.&lt;br/&gt;&lt;br/&gt;Look up &amp;quot;Quiet Execution CustomAction&amp;quot; in the WiX.chm help file and look toward the bottom of the help topic for the section entitled &amp;quot;Deferred execution&amp;quot;.</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#524620</link><pubDate>Sat, 04 Feb 2006 05:27:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:524620</guid><dc:creator>Madnad</dc:creator><description>&lt;p&gt;heaths, thanks for the continued replies. I tried what you suggest but still get the 0002 error. I think it has to do with net.exe because when I change it to something like "notepad" it works. I took out all the params to net.exe so my code now looks like this (still does not work):&lt;/p&gt;
&lt;p&gt;&amp;lt;Property id="QtExecDeferred" Value="c:\windows\system32\net.exe"&amp;gt;&amp;lt;/Property&amp;gt;&lt;br/&gt;&amp;lt;CustomAction id="QtExecDeferred" Return="check" Execute="deferred" DllEntry="CAQuietExec" BinaryKey="wixca" /&amp;gt;&lt;br/&gt;...&lt;br/&gt;&amp;lt;Custom After="InstallInitialize" Action="QtExecDeferred"&amp;gt;NOT Installed&amp;lt;/Custom&amp;gt;&lt;/p&gt;
&lt;p&gt;So now I am not even referencing any of the files I am installing and still I get the error. I'm going nuts :)&lt;/p&gt;</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#524834</link><pubDate>Sat, 04 Feb 2006 19:48:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:524834</guid><dc:creator>Heath Stewart</dc:creator><description>Madnad, you're still not scheduling it in the right place. You must schedule your deferred CA that starts your service after the service file is installed or you will continue to get the error. You should schedule it at least after the InstallFiles action.&lt;br/&gt;&lt;br/&gt;Also - as I mentioned before - you should not hard-code a path. Set your property to &amp;quot;[SystemFolder]net.exe start myservice&amp;quot;.&lt;br/&gt;&lt;br/&gt;Finally, you should expect an error if you don't pass net.exe any arguments since it will return an error in such a case. Why don't you try starting a service in this way using a service that's already installed on your machine and stopped (you could stop it then try installing your app that would start it).&lt;br/&gt;&lt;br/&gt;In order to start your service, however, you MUST schedule it after InstallFiles otherwise your service executable will not be installed when your CA runs and, of course, net.exe will return an error. Don't forget to run your CA to call sc.exe to install your service before trying to start it either. You can't start a service if the service doesn't exist. So, your relative order should be:&lt;br/&gt;&lt;br/&gt;...&lt;br/&gt;InstallFiles&lt;br/&gt;...&lt;br/&gt;sc.exe create ...&lt;br/&gt;net.exe start ...&lt;br/&gt;...</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#524951</link><pubDate>Sun, 05 Feb 2006 01:11:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:524951</guid><dc:creator>Madnad</dc:creator><description>heaths, thanks for the reply. I've already tried all this :) many times... still nothing. I'll keep you posted on any developments... </description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#533982</link><pubDate>Fri, 17 Feb 2006 12:34:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:533982</guid><dc:creator>Varsik</dc:creator><description>I want a little function to be run as an castom action. What kind of project shall &lt;br&gt;i create to suppress the console window &lt;br&gt;when installing. I change /subsystem as you saggest, but it doesn`t help. May be the problem in kind of a project?</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#533996</link><pubDate>Fri, 17 Feb 2006 13:03:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:533996</guid><dc:creator>VHR</dc:creator><description>I use Setup Wizard .NET.&lt;br&gt;I want a little function to call&lt;br&gt;as a castom action. Which kind of &lt;br&gt;project can I create for executable&lt;br&gt;to suppress the console window. I&lt;br&gt;change &amp;quot;/subsystem switch&amp;quot; as you suggest&lt;br&gt;but it doesn`t helps. May be the problem is &lt;br&gt;what kind of project to choose for executable.</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#534188</link><pubDate>Fri, 17 Feb 2006 20:17:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:534188</guid><dc:creator>Heath Stewart</dc:creator><description>Varsik, I'm going to assume you're also VHR since the content of the post is the same and answer this once for both. Either way, it should equally apply.&lt;br&gt;&lt;br&gt;The &amp;quot;little function&amp;quot; is your custom action - you don't call a custom action from a custom action (well, you can, actually, but that's typically not necessary). It would help to know what you're trying to accomplish, though. You should almost always try to use a DLL custom action server because it lets you log to the same MSI log (logging goooood!) and can be a little easier to debug.&lt;br&gt;&lt;br&gt;Typically the only good reason for an EXE is because you're installing an EXE that already does what you need it to do, and it would be cumbersome to reimplement that in a DLL just for install/patch/repair scenarios. Another reason is that an EXE exists on the system already and its difficult or seemingly impossible to implement it in a DLL, like the ngen.exe executable for generating native images from .NET assemblies. Generally, try to avoid EXE custom actions.</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#579101</link><pubDate>Wed, 19 Apr 2006 19:24:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:579101</guid><dc:creator>Jeremy</dc:creator><description>so have you really provided a way to suppress the console on an .exe and using custom action type 18 or 2?&lt;br&gt;&lt;br&gt;all i have read is use wix or change flags passed to createprocess.&lt;br&gt;&lt;br&gt;neither of which are available to me.</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#579107</link><pubDate>Wed, 19 Apr 2006 19:34:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:579107</guid><dc:creator>Heath Stewart</dc:creator><description>Jeremy, why isn't writing your own custom action that calls your EXE using the CreateProcess function not available to you? If you can't write such a CA, you can use the custom action server DLL from WIX without having to use WIX to create your Windows Installer packages.&lt;br&gt;&lt;br&gt;If your EXE runs under the console subsystem, there's no flags you can pass to type 2, 18, 34, and 50 custom actions to prevent the window from being displayed. For this reason you need to use a CA that will create the process silently.</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#696456</link><pubDate>Sat, 12 Aug 2006 13:52:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:696456</guid><dc:creator>Nick Heim</dc:creator><description>Hi Heat,&lt;br&gt;is there a way to call an exe from a CA with this technic, which is stored in the binary table and not on the HD itself?</description></item><item><title>re: Suppressing Console Windows for Custom Actions</title><link>http://blogs.msdn.com/heaths/archive/2006/01/23/516455.aspx#697860</link><pubDate>Sun, 13 Aug 2006 21:39:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:697860</guid><dc:creator>Heath Stewart</dc:creator><description>Nick, you would need to first extract the EXE, but then you'd be responsible for cleaning it up in all scenarios (rollback, commit, uninstall). It would be better to let Windows Installer handle that.&lt;br&gt;&lt;br&gt;You should also avoid using EXE custom actions anyway, since they can't log to the same file nor can they access the MSI database. If you're not planning on installing the EXE (for example, maybe it's a useful command-line tool after install) you'd best stick with a DLL.</description></item></channel></rss>