2

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!

Ish Goel
  • 315
  • 1
  • 7
  • 16
  • How are the forms stored in the repository? Does each of the 5 produce a DLL or do they just have a Win Forms project? – Alex Apr 18 '12 at 08:00
  • @Alex - Each of the 5 have win forms project. They upload the forms using SVN and finally I develop a DLL of all the forms together. Thanks! – Ish Goel Apr 18 '12 at 08:11
  • This doesn't make sense to me: `The problem is that I have to individually compile each form manually after opening Visual Studio and adding the forms in the project.`. What exactly do you mean? What needs to be done individually? Why can't each person just add the forms to a single VS project? I think so clarification of you current workflow and final goals would help – Sam Holder Apr 18 '12 at 08:31
  • There are 18 VisualStudio Projects where forms are added. I compile each project separately to generate 18 DLLs which are then referenced together to make a single solution. **My requirement is to automate this task of compiling 18 projects using a GUI app**. Any help for a better way will be appreciated – Ish Goel Apr 18 '12 at 08:41
  • why not just have a solution which has the 18 projects in it? – Sam Holder Apr 18 '12 at 09:02
  • Thats true. But it results in un-necessary compilation when only few new forms are added. My question is to automate this task of adding new forms and compiling again and again. – Ish Goel Apr 18 '12 at 09:13
  • set up a build server. then when ever the solution is checked back in everything can be automatically built. The new forms are automatically included in the new build, everything is in a single place and you can check out a working version of the solution, no manual processes involved. I think you are making work for yourself where non should exist. – Sam Holder Apr 18 '12 at 09:55
  • @IshGoel how long does compilation take? We have a solution with 72 projects and it only takes a couple of mins to compile... – Sam Holder Apr 19 '12 at 08:40
  • @SamHolder We are a small group of people who are trying to multitask. Hence, the need of automating the entire procedure although it takes only seconds to compile. I am still researching on Build server and msbuild options, only without much success. Thanks a lot for your guidance. :) – Ish Goel Apr 20 '12 at 17:20

3 Answers3

1

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.

Lukasz Madon
  • 14,664
  • 14
  • 64
  • 108
0

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...

Sam Holder
  • 32,535
  • 13
  • 101
  • 181
  • Sam, we are developing an ERP solution which has 18modules. Each module has approximately 200 forms right now which are compiled in their respective module. Will it be a good idea to compile them as separate plugins? – Ish Goel Apr 18 '12 at 08:14
  • @IshGoel the workflow you have currently is still not clear to me, but is your stated aim 'programmatically adding Forms to Visual Studio Project' or 'programmatically adding Forms to application'. What happens to the forms when you add them to VisualStudio? I don't see a particular downside to having the forms as plugins except that you may incurr some delay on startup for your application as you load all of the plugins. – Sam Holder Apr 18 '12 at 08:30
  • There are 18 VisualStudio Projects where forms are added. I compile each project separately to generate 18 DLLs which are then referenced together to make a single solution. In case of Plugins, will it not be tough to decide which Form belongs to which module? And also, what about managing approx. 3500 plugins rather than 18 dlls? Thanks for your help – Ish Goel Apr 18 '12 at 08:37
0

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.

Community
  • 1
  • 1
  • I am new to frameworks like MEF or MAF. Read your posted link but couldn't gather much. Will it be able to solve my compilation problems? Once again quoting, "There are 18 VisualStudio Projects where forms are added. I compile each project separately to generate 18 DLLs which are then referenced together to make a single solution. My requirement is to automate this task of compiling 18 projects using a GUI app" – Ish Goel Apr 18 '12 at 09:04