C
C#2y ago
Eris

❔ How can I start project from another project?

Heyo! So in one solution I have two projects, Project 1 and Project 2. Project 1 is a WinForms app and is the "main" one, and Project 2 is a Console Application, which I've added to Project 1's references. How can I "run" Project 2 from within Project 1? I've googled for a while but I'm not sure how to phrase this. Thanks for reading!
13 Replies
Pobiega
Pobiega2y ago
you'd need to start it with Process.Start the "reference" just lets project 1 access the public classes from project 2
Eris
ErisOP2y ago
ah, so I would need to point to Project 2's exe?
Pobiega
Pobiega2y ago
more or less, yes In general, its pretty rare for a program you wrote to call another program you wrote. Its usually better to just include the functionality of program 2 in program 1 There are ofc exceptions, like making a GUI for a complicated command line program
cap5lut
cap5lut2y ago
if its just for debugging purpose and alike u can also configure the start projects:
Pobiega
Pobiega2y ago
yeah you can set VS to start both programs but that would just be during development
Eris
ErisOP2y ago
I've tried to but using a console (as in writing to it and reading inputs from it) from winforms is pretty hellish from what I've found so far
Pobiega
Pobiega2y ago
thats exactly why I said what I said you'd remake the CLI functionality in a GUI inside winforms instead trying to make a GUI "control" an interactive console app is... yea don't
cap5lut
cap5lut2y ago
that sounds like u want actually 3 projects. a class library containing the logic a console application for ur CLI functionality using that class library and another for ur winforms
Pobiega
Pobiega2y ago
yep, thats probably what you want unless you are planning to entirely replace the console app
Eris
ErisOP2y ago
gotcha, right
Pobiega
Pobiega2y ago
programs interacting with eachother without dedicated APIs for doing so can be very messy
Eris
ErisOP2y ago
okay, I'll rethink this a bit, thank you!
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?