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);
        }
Ejemplo n.º 2
0
        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);
        }