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