Solved

C# command line app, invisible to windows installer

Posted on 2014-01-21
5
436 Views
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.

Thanks,
Mike
0
Comment
Question by:thready
[X]
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
5 Comments
 
LVL 36

Accepted Solution

by:
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
0
 
LVL 1

Author Closing Comment

by:thready
ID: 39803521
You rock.  Thanks!
0
 
LVL 1

Author Comment

by:thready
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...

Thanks,
Mike
0
 
LVL 36

Expert Comment

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

Author Comment

by:thready
ID: 39837324
Thank you very much! :-)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
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.
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

717 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