[英]Add multiple projects programmatically into Visual Studio solution?
如何以编程方式将多个项目添加到Visual Studio解决方案中?
如果我正在使用
solution.addfromtemplate(template1);
solution.addfromtemplate(template2);
然后用template1覆盖项目吗?
取决于您究竟愿意实现什么。 如果要创建VSX包,则可以在Visual Studio自动化对象模型-DTE中使用顶级对象:
var dte = Package.GetGlobalService(typeof(DTE)) as DTE2;
Solution2 sln= (Solution2)dte.Solution;
//this will create a solution
sln.Create("<PATH>", "<SOLUTION NAME>");
//here you get the project template which you want to use
string csTemplatePath = sln.GetProjectTemplate("ConsoleApplication.zip", "CSharp");
sln.AddFromTemplate(csTemplatePath, @"C:\fooFolder\FooBar", "Foo", false);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.