Reputation: 51
How do I take a Visual Studio Solution (.sln) as input and get a list of all the projects it contains?
Upvotes: 1
Views: 683
Reputation: 4905
This array will give you full solution details with project created with in solution...
public List<string> getAllProjectNames(string path)
{
string[] arr = System.IO.File.ReadAllLines(path);
List<string> projects = new List<string>();
for (int i = 0; i < arr.Length; i++)
{
if (arr[i].StartsWith("Project"))
{
string [] temp = arr[i].Split(',');
projects.Add(temp[1]);
}
}
return projects;
}
Call this method like...
List<string> Arr = getAllProjectNames(@"D:\Projects\PersonalRD\SearchingList\SearchingList.sln");
after that try to search all project names where the string item starts with project...
Upvotes: 2
Reputation: 42333
It's just a text file. Open it up in a text editor and see. You're looking for all the Project directives. Writing a simple parser to just extract the *.vcproj names shouldn't be difficult at all.
Upvotes: 1