开发者

combine multiple C# projects

Summary: Create master application to run other applications by combining code in visual studio.

Details: I have 3 projects (all c#) that i can open in visual studio. They all work. They are all GUI based applications. I want to create a master application with just a few buttons on it that will open each application if the corresponding button is clicked.

I know that i can accomplish this by "System.Diagnostics.Process.Start(@"pr开发者_JAVA百科ogram1.exe");" but i don't want to package it all together and have to give my coworkers multiple exe files and hope they read the instructions and execute the right file. I would like to instead take all the .cs files from the applications and import them into my master application. I want program1's files to kick off when i press program1button and have it start as it normally does. Is this possible?

example: This master application will look like the below description. When program1button is clicked i want to run program1.

_____________________
| master application|
|                   |
|  |program1Button| |
|                   |
|  |program2Button| |
|                   |
|  |program3Button| |
|                   |
|___________________|


So if you want all of the code in one project, and one .exe, you'll need to merge all of the logic into one solution and project file.


It's very easy.

  1. You can create a new exe project, winform or WPF based on your previous app.
  2. You can add each project in your solution and add all three projects as reference to new project.
  3. Each of your earlier project will have a start point. That you have to manually do in your new project.

WinForm has start point as Application.Run(new MainForm());

So in your new project you can simply create a new instance of form and launch it.

In WPF, also you have to simply create instance of new window based on selection and show the form

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜