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