How can I parse Visual Studio solution (SLN) files in .NET?
I would like to write an app that merges multiple solutions into one while saving the relative build order.
C# – Parsing Visual Studio Solution files
.netc++parsingvisual-studio
Related Question
- .net – What does the Visual Studio “Any CPU” target mean
- C# – How to update the GUI from another thread
- C# – How to remedy “The breakpoint will not currently be hit. No symbols have been loaded for this document.” warning
- Visual-studio – Difference between Build Solution, Rebuild Solution, and Clean Solution in Visual Studio
- Visual-studio – Compare two files in Visual Studio
- Visual-studio – Error message “No exports were found that match the constraint contract name”
- .net – the difference between .NET Core and .NET Standard Class Library project types
Best Solution
The .NET 4.0 version of the Microsoft.Build assembly contains a SolutionParser class in the Microsoft.Build.Construction namespace that parses Visual Studio solution files.
Unfortunately this class is internal, but I've wrapped some of that functionality in a class that uses reflection to get at some common properties you might find helpful.
Note that you have to change your target framework to ".NET Framework 4" (not client profile) to be able to add the Microsoft.Build reference to your project.