How to Generate Visual Studio 2008 C# solution on fly
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));
精彩评论