[英]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. 我正在由5个人组成的团队在Visual Studio 2008中开发一个项目。 Each of the 5 people develop Windows forms and a repository in maintained on the server.
这5个人中的每一个都开发Windows表单,并在服务器上维护一个存储库。 The problem is that I have to individually compile each form manually after opening Visual Studio and adding the forms in the project.
问题是,在打开Visual Studio并将表单添加到项目中之后,我必须分别手动编译每个表单。
I want to add and compile the forms using a GUI and not Visual Studio as such. 我想使用GUI而不是Visual Studio来添加和编译表单。 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. 基本上,解决方案在于以编程方式将Forms添加到Visual Studio Project中,我不确定是否可以开发这样的应用程序。 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.
问题是,在打开Visual Studio并将表单添加到项目中之后,我必须分别手动编译每个表单。
You can csc.exe which is a commandline C# compiler. 您可以使用csc.exe,它是命令行C#编译器。 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
我想使用GUI而不是像这样的Visual Studio添加和编译表单
I don't understand .Do you want to add and compile forms using a GUI app or add GUI? 我不明白。您要使用GUI应用程序添加和编译表单还是添加GUI?
Basically, the solution lies in programmatically adding Forms to Visual Studio Project I am not sure if such an application could be developed
基本上,解决方案在于以编程方式将窗体添加到Visual Studio Project中,我不确定是否可以开发这样的应用程序
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.
您必须将C#代码添加到源代码中。 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 . 您可以开发脚本来从命令行( 命令行参考 )执行msBuild任务,或者开发GUI来启动外壳程序以运行这些任务,或者可以从脚本/命令提示符下使用csc.exe 手动进行编译 。
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. 如果您有要构建的项目文件,则MsBuild选项将很有用,csc选项的级别较低,将需要更多的工作,但不需要您拥有项目文件,而只需源代码文件和依赖项。
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.
然后,您将每种表单开发为接口,并将其打包在其自己的dll中,并让应用程序加载插件dll,并提取出实现特定接口的表单。 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. 您可能要考虑使用诸如MEF或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) 在MEF和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. 很像用户控件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.