private static string SetMSBuildSdksPath(DotNetCliService dotNetCli) { var oldMSBuildSDKsPath = Environment.GetEnvironmentVariable(MSBuildSDKsPath); var info = dotNetCli.GetInfo(); var msbuildSdksPath = Path.Combine(info.BasePath, "Sdks"); if (Directory.Exists(msbuildSdksPath)) { Environment.SetEnvironmentVariable(MSBuildSDKsPath, msbuildSdksPath); } return(oldMSBuildSDKsPath); }
private string GetSdksPath(string projectFilePath) { var info = _dotNetCli.GetInfo(Path.GetDirectoryName(projectFilePath)); if (info.IsEmpty || string.IsNullOrWhiteSpace(info.BasePath)) { return(null); } var result = Path.Combine(info.BasePath, "Sdks"); return(Directory.Exists(result) ? result : null); }