Click here to Skip to main content
15,793,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,I have added a console project to my main main project is winforms.
How can I run the console project in the mainform project?
Sergey Alexandrovich Kryukov 10-Feb-12 22:01pm    

1 solution

Process.Start(path to console app)
Share this answer
ready to learn 10-Feb-12 12:55pm    
I tested it .by using this method only a window opens which I can select the console project from.Then the console projects opens in vs window. I want the console project to run in a black screen.
Christian Graus 10-Feb-12 12:56pm    
If you specify the path to the app, the app will run. That is the only way in C# to run an external app. It does not care that it's a console app.
ready to learn 10-Feb-12 13:01pm    
Thaks a lot it worked well.What if I don't know the installation path.suppose that I want to instal my project on another computer.Then How can I set the path?
Christian Graus 10-Feb-12 13:04pm    
string appPath = Path.GetDirectoryName(Application.ExecutablePath); will get you the folder your app is in, you can use that to build the path if it's in your folder. You can write code to trawl the file system, but if it's an exteral app, you're better off asking the user to tell you where it is and storing that info.
ready to learn 10-Feb-12 13:10pm    
Thanks a lot again

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900