C# command line app, invisible to windows installer

Posted on 2014-01-21
Last Modified: 2014-02-05
Hi Experts,
I need to create a C# command line app that won't show a window popup when called from a windows installer.  Is my best bet a "console application" or an "empty project"?  I need the return code of the main to indicate the success or failure of the command line.

Question by:thready
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 36

Accepted Solution

Miguel Oz earned 500 total points
ID: 39798530
Create a console app and called from custom install methods using Process start method.
Your console app will return 0 when running OK or a number if there is an error, also you write the errors to console and use RedirectStandardOutput on ProcessStartInfo to capture output of your console app directly

Note: I used this construct all the time when I need to run silence updates in installers

Author Closing Comment

ID: 39803521
You rock.  Thanks!

Author Comment

ID: 39836887
Side question, sorry - do you know if it's possible to create a c# forms application that would not have any UI that could also redirect its output?  Or would "console" not even be available in this type of project?   I ask this because the command line is part of an installer and I don't want to see the black window come up while it does its thing...

LVL 36

Expert Comment

by:Miguel Oz
ID: 39837315
Set this property to Hidden(not visible) when you run console app.

Author Comment

ID: 39837324
Thank you very much! :-)

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question