Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6797323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:35:41+00:00 2026-05-26T18:35:41+00:00

I’m working on a solution in Visual Studio 2010 Ultimate that contains two C#

  • 0

I’m working on a solution in Visual Studio 2010 Ultimate that contains two C# projects: a Forms project and a console project. Programmatically, they are completely separate; the main portion of both projects could run without the other. What I would like to do is invoke the console application by pressing a button in the Forms application, with certain options set based on the Forms application. So you can think of the Forms application as essentially just a ‘launcher’ app.

The way I have this implemented right now is by using System.Diagnostics.Process.Start with "cmd" as the first parameter and the path to the console application’s executable (plus CLI arguments) as the second parameter. But this is a terrible solution, because it will break when deployed to other machines with an installer.

I’ve also tried creating a reference to the console project in the Forms object, making Program in the console project public and static, and calling the console project’s Main method, but because there’s no valid output handle, this eventually causes an exception to be thrown.

I’ve done much Googling, some searching here on SO, and even checked the ‘Similar Questions’ on the submission page, and no one seems to know how to do what I want to do. Any pointers that could put me on the right track?

FYI: I know that there’s probably ten million better ways to do this, but I have several reasons for wanting and needing it done this way. I know I could just make a separate GUI for the CLI program and copy the relevant code over, or merge everything into one project and make a separate output window, or various other solutions like those. But I need this solution for two reasons: (1) I had a fairly complex CLI program that works well as a CLI program, and now need a user-friendly way to start it, and (2) solving the problem in other ways doesn’t answer the question of “Why bother having several executable projects in the same solution in the first place if you can’t invoke one from the other?”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:35:42+00:00Added an answer on May 26, 2026 at 6:35 pm

    The way you’re doing it is fine – it just needs a bit of tweaking.

    Firstly, when you launch, don’t run cmd with your executable as a parameter, run your console application myapp.exe directly as the command to execute in Process.Start.

    The next step is to make your application run from wherever it was installed. The easiest approach to this is to simply deploy both executables side-by-side in the same folder. Use Application.StartupPath to find the folder that your Forms application was launched from (and hence where the other app resides). Use Path.Combine(Path.GetDirectory(Application.StartupPath), "myapp.exe") to generate the full pathname of the exe to run.

    Another option is to use an installer that can then store the location of the other app in a known place (e.g. a registry key), but that’s a magnitude more complexity for little gain (unless you need the installer for other reasons).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.