private static Version GetProjectFileToolsVersion(string path)
{
Version version;
try
{
XElement element = XDocument.Load(path).Element("{http://schemas.microsoft.com/developer/msbuild/2003}Project");
if (element == null)
{
return new Version(0, 0);
}
version = new Version(element.Attribute("ToolsVersion").Value);
}
catch (Exception exception)
{
throw new Exception(string.Format("Failed to extract ToolsVersion while reading '{0}'", path), exception);
}
return version;
}