C
C#11mo 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
Pobiega11mo ago
you'd need to start it with Process.Start the "reference" just lets project 1 access the public classes from project 2
Eris
Eris11mo ago
ah, so I would need to point to Project 2's exe?
Pobiega
Pobiega11mo 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
cap5lut11mo ago
if its just for debugging purpose and alike u can also configure the start projects:
Pobiega
Pobiega11mo ago
yeah you can set VS to start both programs but that would just be during development
Eris
Eris11mo 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
Pobiega11mo 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
cap5lut11mo 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
Pobiega11mo ago
yep, thats probably what you want unless you are planning to entirely replace the console app
Eris
Eris11mo ago
gotcha, right
Pobiega
Pobiega11mo ago
programs interacting with eachother without dedicated APIs for doing so can be very messy
Eris
Eris11mo ago
okay, I'll rethink this a bit, thank you!
Accord
Accord11mo 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.