开发者

How to Generate Visual Studio 2008 C# solution on fly

开发者 https://www.devze.com 2023-02-01 05:32 出处:网络
We are planning to implement a simulator generator program th开发者_StackOverflowat will generate C# solution. Does there exist any object model for Visual Studio 2008 for this. Another option is cust

We are planning to implement a simulator generator program th开发者_StackOverflowat will generate C# solution. Does there exist any object model for Visual Studio 2008 for this. Another option is custom project template i guess but i would prefer first one. Any help will be appreciated.


You could use Visual Studio automation, it's called DTE. But if this is all you want, then just create a solution by hand, because it's a simple text file, and a csproj is a simple XML.


To create a new, empty solution, the easiest way is via the Visual Studio automation. Look at the Solution.Open method. There is another way, via the IVsSolution interface. You could do it like this:

var solution = (IVsSolution)GetService(typeof(SVsSolution));
ErrorHandler.ThrowOnFailure(solution.CreateSolution(solutionPath, solutionName, 0));
0

精彩评论

暂无评论...
验证码 换一张
取 消