Reputation: 3109
I used text editor to open an .sln file, it looks like a tree structure, but it's not xml format.
Do you know what format it is, and can we process it using C#, like processing xml conveniently?
Upvotes: 13
Views: 9056
Reputation: 19019
Add Microsoft.Build from NuGet and then:
using Microsoft.Build.Construction;
var sln = SolutionFile.Parse(filename);
Upvotes: 3
Reputation: 5223
Take a look at:
https://github.com/tapika/syncProj
Solution.LoadSolution
will decrypt solution information for you in code.
Upvotes: 1
Reputation: 9478
Here is the description of the format: https://msdn.microsoft.com/en-us/library/bb165951(v=vs.140).aspx
You're right, it is not XML, but another text-based format:
The .sln file contains text-based information the environment uses to find and load the name-value parameters for the persisted data and the project VSPackages it references.
And for parsing the file you can look at this question: Parsing Visual Studio Solution files
Upvotes: 13