Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, Everyone.
Please I am new to c# program. I want to ask is it is possible to combine 3 separate independent programs to one executable file.
To explain what I mean:
program_1 has its' own .sln
program_2 has its' own .sln
program_2 has its' own .sln

,and I want to has a single .sln to output a single program.exe
They are all console APP.

Any guide would be highly appreciated

What I have tried:

I have no knowledge of what to search for but was thinking of referencing using assembly of which i am still not sure what to search for or lookout for.
Posted
Updated 21-Jun-22 6:45am

Generally speaking, you don't - because one console doesn't share well with three apps: the inputs and outputs would get mixed up and it just wouldn't work.

However, it is pretty simple to create a "master app" that causes the other three to open.

Create a new app, and use Process.Start[^] to execute the other three, then close the "master app". If you add references to the other three projects, then the executables will be copied to the EXE folder from your master app so they are easy to find.
 
Share this answer
 
Comments
mbah obiora 21-Jun-22 7:30am    
Thanks, let me try your suggestion out.
OriginalGriff 21-Jun-22 7:41am    
You're welcome!
Take a look at: GitHub - Fody/Costura: Embed references as resources[^] and ILMerge is a static linker for .NET Assemblies.[^]
But these probably won't allow you to merge different solutions.
 
Share this answer
 
Comments
mbah obiora 22-Jun-22 4:19am    
I am not trying to merge the different solutions what am trying to achieve is to be able to combine the 3 projects into one. In each of the project is a program.cs class which which I intend to rename to program1.cs, program2.cs, program3.cs and there after create a new program.cs that will refernce or link the others.
RickZeeland 22-Jun-22 5:51am    
If it is a console application, make a menu and use ReadKey to get user input, then execute the code you want. If it is Winforms make a main form and run the form you want from there.

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