Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I start a second console application in Visual Studio when one is already running

I am working through some examples in a WCF book. There is a Host project and Client project within a single solution. Both are console applications. The Host is the startup app, but the Client app doesn't seem to open the Console like the book says. Book says while the Host is running, run the Client. The Run button is disabled tho as it is already running. The book example definitely has them in the same solution and a single instance of Visual Studio. Anyways, what am I missing here? I have done this with two instances of VS, but I truly have never does this in a single instance. Any help is always appreciated.

Cheers, ~ck in San Diego

like image 909
Hcabnettek Avatar asked Apr 02 '10 05:04

Hcabnettek


People also ask

How do I add a console to visual studio?

Open Visual Studio, and choose Create a new project in the Start window. In the Create a new project window, select All languages, and then choose C# from the dropdown list. Choose Windows from the All platforms list, and choose Console from the All project types list.

How do I call one console application from another C#?

You can use Process. Start to start the other console application. You will need to construct the process with ProcessStartInfo. RedirectOutput set to true and UseShellExecute set to false in order to be able to utilize the output yourself.

How do I Debug two projects in Visual Studio?

On the Properties page, select Common Properties > Startup Project. Select Current selection, Single startup project and a project file, or Multiple startup projects. If you select Multiple startup projects, you can change the startup order and action to take for each project: Start, Start without debugging, or None.

How do I keep the console open in Visual Studio?

To keep the console window open in Visual Studio without using the Console. ReadLine() method, you should run the application without debug mode by pressing Ctrl+F5 or by clicking on the menu Debug > Start without Debugging option.


2 Answers

You can also make both console apps start at once when you debug.

  • In Solution Explorer, right-click the solution, and select Properties.
  • In the left pane, select Common Properties | Startup Project.
  • Then, on the right, select Multiple Startup Projects.
  • You can set any number of your projects to start - with or without debugging.
like image 181
Lance Fisher Avatar answered Oct 26 '22 09:10

Lance Fisher


Right-Click on the host project in solution explorer then go to debug -> start new instance.

Once it is running you can do the same thing to start the client project, or, you can press F5 like normal if the client project is the startup project.

like image 28
Jimmie R. Houts Avatar answered Oct 26 '22 09:10

Jimmie R. Houts