Skip to content

Instantly share code, notes, and snippets.

@bchavez
Created August 29, 2017 01:32
Show Gist options
  • Save bchavez/2b1fa005d3363c7d1e9c83ea5a8d2ee0 to your computer and use it in GitHub Desktop.
Save bchavez/2b1fa005d3363c7d1e9c83ea5a8d2ee0 to your computer and use it in GitHub Desktop.
Scans corefx repo for all csproj files and extracts pertinent information for creating a master .SLN file.
var csprojs = Directory.GetFiles(".", @"*.csproj", SearchOption.AllDirectories)
.Where(projFile => !projFile.Contains(@"\ref\"))
.Select(projFile => new { name = Path.GetFileNameWithoutExtension(projFile), file = projFile, guid = GetProjectGuid(projFile) })
.Where( p => p.guid.IsNotNullOrWhiteSpace() );
foreach (var project in csprojs)
{
$@"Project(""{{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}}"") = ""{project.name}"", ""{project.file}"", ""{project.guid}""".Dump();
}
string GetProjectGuid(string projFile)
{
var data = File.ReadAllText(projFile);
return data.GetBetween("<ProjectGuid>", "</ProjectGuid>");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment