简体   繁体   中英

How to add and compile windows forms in Visual Studio project using a GUI, and not directly from Visual Studio?

I am developing a project in Visual Studio 2008 with a team of 5 people. Each of the 5 people develop Windows forms and a repository in maintained on the server. The problem is that I have to individually compile each form manually after opening Visual Studio and adding the forms in the project.

I want to add and compile the forms using a GUI and not Visual Studio as such. Is this possible?

Basically, the solution lies in programmatically adding Forms to Visual Studio Project I am not sure if such an application could be developed. Any help will be highly appreciated.

Thanks!

The problem is that I have to individually compile each form manually after opening Visual Studio and adding the forms in the project.

You can csc.exe which is a commandline C# compiler. Make a script that pulls the code and compiles it.

I want to add and compile the forms using a GUI and not Visual Studio as such

I don't understand .Do you want to add and compile forms using a GUI app or add GUI?

Basically, the solution lies in programmatically adding Forms to Visual Studio Project I am not sure if such an application could be developed

If you had already a project that is set-up (dependencies) is it fairly easy. You have to add C# code to the source code. It depends on the size of a modification, but it should be done with a couple of lines of script.

You could either develop scripts to execute msBuild tasks from the command line ( command line reference ) and develop a GUI to start a shell to run those, or you can use the csc.exe from a script/command prompt to do the compilation manually .

The MsBuild option will be useful if you have project files you want to build, the csc option is more low level and will require more work but will not require you to have a project file, just the source code files and dependencies.

This sounds like the wrong way to go though. Are you sure that you don't want to develop an application that can have plugins? then you develop each form to an interface and package it up in its own dll, and have the application load the plugin dlls and extract out the forms which implement the particular interface. That way you build the app once, and can add new forms without having to recompile at all...

You might want to consider using a plug-in/add-in framework such as MEF or MAF. Team members can then be responsible for their own forms which are popped into a plug-in for you to use.

Choosing between MEF and MAF (System.AddIn)

Such a thing allows you to dynamically control how forms/controls are displayed at runtime or depending how you implement the plug-in system, allow you to drag-n-drop your layout at design time.

Much like user controls.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM