I am working on a code generator project that creates solution with customizable layers.
for now I am able to create the .sln file by writing all the elements in code. but the project files don’t need this, they can be edited using MSBuild Project class.
I want to add a Website project template support and etc, so this way I edit the .sln file is not cool, I wanted to know that is there a better way to do this, like MSBuild or something else ?
I saw Programmatically generate Visual Studio Solution that says to use Visual Studio SDK (which is for extending visual studio, writing plugins …), but there isn’t any code sample.
thanks in advance
Here is how to use SLNTools to create sln file in code. The code is a mess! But it works!
SLN Tools project is able to create sln file from project files. It’s open source and it provides UI for editing and merging sln files. In this case you can use the core project and by referencing the ‘CWDev.SLNTools.Core.dll’ in your project you can write a messy(!) code like this:
NOTE: Some parts of class are not shown here and also There’s some custom objects of my own project like Sln, Project and … that should not be mistaken with SLNTools Objects with same name. I commented whereever needed!
Hope it helps.