简体   繁体   English

如何以编程方式创建多个项目的解决方案?

[英]How to create solution with multiple projects programmatically?

I want to create solution with multiple projects. 我想用多个项目创建解决方案。

I think I have three options: 我想我有三个选择:

  1. EnvDTE EnvDTE
  2. Microsoft.Build Microsoft.Build
  3. Manually create *.sln and *.csproj files 手动创建* .sln和* .csproj文件

I googled but didn't found good examples for 1 and 2 options ( I mean how to create solution, add projects, add refereces, add new or existing project items, etc... ) 我用谷歌搜索但没有找到1和2选项的好例子( 我的意思是如何创建解决方案,添加项目,添加引用,添加新的或现有的项目项等等

third option, I think, is easier but if there are good options, I don't need to create projects manually. 我认为第三种选择更容易,但如果有很好的选择,我不需要手动创建项目。

So my questions are: 所以我的问题是:

Is there any other options to create projects programmatically? 是否还有其他以编程方式创建项目的选项?

and Which option is better? 哪个选项更好?

Thanks. 谢谢。

Just manually create the sln and csproj files (and other required files) manually, the formats are very simple. 只需手动手动创建sln和csproj文件(以及其他所需文件),格式非常简单。 You can make this an easy task by creating a new solution with two projects in Visual Studio, and just inspecting the contents of the sln and csproj files. 通过在Visual Studio中创建包含两个项目的新解决方案,并且只检查sln和csproj文件的内容,可以使此操作变得简单。 The idea here is that you are just making yourself a template. 这里的想法是你只是让自己成为一个模板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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