Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions src/XMakeBuildEngine/Definition/ToolsetReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,28 @@ ToolsetDefinitionLocations locations
var props = new PropertyDictionary<ProjectPropertyInstance>();

var libraryPath = NativeMethodsShared.FrameworkBasePath;
if (!string.IsNullOrEmpty(libraryPath))
{
libraryPath = Path.GetDirectoryName(libraryPath);
}

if (!string.IsNullOrEmpty(libraryPath))
{
var r = new Regex(libraryPath + Path.DirectorySeparatorChar + @"\d+\.\d+");
foreach (var d in Directory.GetDirectories(libraryPath).Where(d => r.IsMatch(d)))
// The 4.0 toolset is installed in the framework directory
var v4dir = FrameworkLocationHelper.GetPathToDotNetFrameworkV40(DotNetFrameworkArchitecture.Current);
if (v4dir != null)
{
toolsets.Add(
"4.0",
new Toolset(
"4.0",
v4dir,
environmentProperties,
globalProperties,
currentDir,
string.Empty));
}

// Other toolsets are installed in the xbuild directory
var xbuildToolsetsDir = Path.Combine(libraryPath, "xbuild");
var r = new Regex(xbuildToolsetsDir + Path.DirectorySeparatorChar + @"\d+\.\d+");
foreach (var d in Directory.GetDirectories(xbuildToolsetsDir).Where(d => r.IsMatch(d)))
{
var version = Path.GetFileName(d);
if (version != null && !toolsets.ContainsKey(version))
Expand All @@ -185,7 +198,7 @@ ToolsetDefinitionLocations locations
version,
new Toolset(
version,
d,
Path.Combine(d,"bin"),
environmentProperties,
globalProperties,
currentDir,
Expand Down