Skip to content

Commit

Permalink
Filetracker from global ANSI path (dotnet#1623)
Browse files Browse the repository at this point in the history
Fixes internal bug https://devdiv.visualstudio.com/DevDiv/_workitems/edit/286164 (in conjunction with a change to setup authoring to put FileTracker DLLs in the right place) by ensuring that the DLL that FileTracker attempts to inject in child processes has a path that is 8-bit-character compatible.
  • Loading branch information
rainersigwald committed Jan 31, 2017
1 parent 8462223 commit e32f324
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/Utilities/TrackedDependencies/FileTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,24 @@ private static string GetPath(string filename, DotNetFrameworkArchitecture bitne

// Look for FileTracker.dll/Tracker.exe in the MSBuild tools directory. They may exist elsewhere on disk,
// but other copies aren't guaranteed to be compatible with the latest.
return ToolLocationHelper.GetPathToBuildToolsFile(filename, ToolLocationHelper.CurrentToolsVersion, bitness);
var path = ToolLocationHelper.GetPathToBuildToolsFile(filename, ToolLocationHelper.CurrentToolsVersion, bitness);

// Due to a Detours limitation, the path to FileTracker32.dll must be
// representable in ANSI characters. Look for it first in the global
// shared location which is guaranteed to be ANSI. Fall back to
// current folder.
if (s_FileTrackerFilename.Equals(filename, StringComparison.OrdinalIgnoreCase))
{
string progfilesPath = Path.Combine(FrameworkLocationHelper.GenerateProgramFiles32(),
"MSBuild", MSBuildConstants.CurrentProductVersion, "FileTracker", s_FileTrackerFilename);

if (File.Exists(progfilesPath))
{
return progfilesPath;
}
}

return path;
}

/// <summary>
Expand Down

0 comments on commit e32f324

Please sign in to comment.