Solved

C# command line app, invisible to windows installer

Posted on 2014-01-21
5
428 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
  • 3
  • 2
5 Comments
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 500 total points
Comment Utility
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
Comment Utility
You rock.  Thanks!
0
 
LVL 1

Author Comment

by:thready
Comment Utility
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 35

Expert Comment

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

Author Comment

by:thready
Comment Utility
Thank you very much! :-)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now