private GetPathToDotNetFrameworkFile ( string fileName, TargetDotNetFrameworkVersion version ) : string | ||
fileName | string | |
version | TargetDotNetFrameworkVersion | |
Результат | string |
public static bool ForceOutOfProcTracking(ExecutableType toolType, string dllName, string cancelEventName) { bool flag = false; if (cancelEventName == null) { if (dllName != null) { return(true); } if (IntPtr.Size == 4) { if ((toolType == ExecutableType.Managed64Bit) || (toolType == ExecutableType.Native64Bit)) { return(true); } if ((toolType == ExecutableType.ManagedIL) && (ToolLocationHelper.GetPathToDotNetFrameworkFile(s_TrackerFilename, TargetDotNetFrameworkVersion.Version40, Microsoft.Build.Utilities.DotNetFrameworkArchitecture.Bitness64) != null)) { flag = true; } return(flag); } if ((IntPtr.Size != 8) || ((toolType != ExecutableType.Managed32Bit) && (toolType != ExecutableType.Native32Bit))) { return(flag); } } return(true); }
private static string GetPath(string filename, Microsoft.Build.Utilities.DotNetFrameworkArchitecture bitness) { ErrorUtilities.VerifyThrow(s_TrackerFilename.Equals(filename, StringComparison.OrdinalIgnoreCase) || s_FileTrackerFilename.Equals(filename, StringComparison.OrdinalIgnoreCase), "This method should only be passed s_TrackerFilename or s_FileTrackerFilename, but was passed {0} instead!", filename); string str = ToolLocationHelper.GetPathToDotNetFrameworkFile(filename, TargetDotNetFrameworkVersion.Version40, bitness); if ((string.IsNullOrEmpty(str) || !File.Exists(str)) && s_TrackerFilename.Equals(filename, StringComparison.OrdinalIgnoreCase)) { str = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(filename, TargetDotNetFrameworkVersion.Version40, bitness); } return(str); }
/// <summary> /// Determines whether we must track out-of-proc, or whether inproc tracking will work. /// </summary> /// <param name="toolType">The executable type for the tool being tracked</param> /// <param name="cancelEventName">The name of the cancel event tracker should listen for, or null if there isn't one</param> /// <returns>True if we need to track out-of-proc, false if inproc tracking is OK</returns> public static bool ForceOutOfProcTracking(ExecutableType toolType, string dllName, string cancelEventName) { bool trackOutOfProc = false; string trackerPath = null; if (cancelEventName != null) { // If we have a cancel event, we must track out-of-proc. trackOutOfProc = true; } else if (dllName != null) { // If we have a DLL name, we need to track out of proc -- inproc tracking just uses // the default FileTracker.dll from the path. trackOutOfProc = true; } else if (IntPtr.Size == sizeof(Int32)) { // Current process is 32-bit. So we need to spawn Tracker.exe if our tool is // explicitly marked as 64-bit OR is MSIL and we're installed on a 64-bit OS. if (toolType == ExecutableType.Managed64Bit || toolType == ExecutableType.Native64Bit) { trackOutOfProc = true; } else if (toolType == ExecutableType.ManagedIL) { trackerPath = ToolLocationHelper.GetPathToDotNetFrameworkFile(s_TrackerFilename, TargetDotNetFrameworkVersion.VersionLatest, DotNetFrameworkArchitecture.Bitness64); if (trackerPath != null) { // If we found a 64-bit path, we're on a 64-bit OS and need to use it. Otherwise, we're fine. trackOutOfProc = true; } } } else if (IntPtr.Size == sizeof(Int64)) { // Current process is 64-bit. We need to spawn Tracker.exe if our tool is // explicitly marked as 32-bit. if (toolType == ExecutableType.Managed32Bit || toolType == ExecutableType.Native32Bit) { trackOutOfProc = true; } } return(trackOutOfProc); }
/// <summary> /// Given a filename (currently only Tracker.exe and FileTracker.dll are supported), return /// the path to that file. /// </summary> /// <param name="filename"></param> /// <param name="bitness"></param> /// <returns></returns> private static string GetPath(string filename, DotNetFrameworkArchitecture bitness) { string trackerPath; // Make sure that if someone starts passing the wrong thing to this method we don't silently // eat it and do something possibly unexpected. ErrorUtilities.VerifyThrow( s_TrackerFilename.Equals(filename, StringComparison.OrdinalIgnoreCase) || s_FileTrackerFilename.Equals(filename, StringComparison.OrdinalIgnoreCase), "This method should only be passed s_TrackerFilename or s_FileTrackerFilename, but was passed {0} instead!", filename ); // Look for FileTracker.dll/FileTracker.exe first in the MSBuild tools directory, then fall back to .NET framework directory // and finally to .NET SDK directories. trackerPath = ToolLocationHelper.GetPathToBuildToolsFile(filename, ToolLocationHelper.CurrentToolsVersion, bitness); if (String.IsNullOrEmpty(trackerPath)) { trackerPath = ToolLocationHelper.GetPathToDotNetFrameworkFile(filename, TargetDotNetFrameworkVersion.VersionLatest, bitness); if ((String.IsNullOrEmpty(trackerPath) || !File.Exists(trackerPath)) && s_TrackerFilename.Equals(filename, StringComparison.OrdinalIgnoreCase)) { // fall back to looking in the SDK directory -- this is where Tracker.exe will be in the typical VS case. First check // in the SDK for the latest target framework and latest Visual Studio version, since we want to make sure that we get // the most up-to-date version of FileTracker. trackerPath = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(filename, TargetDotNetFrameworkVersion.Version45, VisualStudioVersion.VersionLatest, bitness); // If that didn't work, we may be in a scenario where, e.g., we have VS 10 on Windows 8, which comes with .NET 4.5 // pre-installed. In which case, the Dev11 (or other "latest" SDK) may not exist, but the Dev10 SDK might. Check // for that here. if (trackerPath == null) { trackerPath = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(filename, TargetDotNetFrameworkVersion.Version40, bitness); } } } return(trackerPath); }