diff --git a/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs b/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs index 933e1c9f7..212eabc97 100644 --- a/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs +++ b/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs @@ -3,6 +3,7 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; +using System.Runtime.InteropServices; namespace Microsoft.DotNet.Cli.Build { @@ -92,7 +93,9 @@ namespace Microsoft.DotNet.Cli.Build protected override string GenerateFullPathToTool() { - return "git"; + // Workaround: https://github.com/Microsoft/msbuild/issues/1215 + // There's a "git" folder on the PATH in VS 2017 Developer command prompt and it causes msbuild to fail to execute git. + return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "git.exe" : "git"; } protected override string GenerateCommandLineCommands() diff --git a/build_projects/dotnet-cli-build/GetCommitHash.cs b/build_projects/dotnet-cli-build/GetCommitHash.cs index 8eb18b07c..7e31b45b9 100644 --- a/build_projects/dotnet-cli-build/GetCommitHash.cs +++ b/build_projects/dotnet-cli-build/GetCommitHash.cs @@ -3,6 +3,7 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; +using System.Runtime.InteropServices; namespace Microsoft.DotNet.Cli.Build { @@ -26,7 +27,9 @@ namespace Microsoft.DotNet.Cli.Build protected override string GenerateFullPathToTool() { - return "git"; + // Workaround: https://github.com/Microsoft/msbuild/issues/1215 + // There's a "git" folder on the PATH in VS 2017 Developer command prompt and it causes msbuild to fail to execute git. + return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "git.exe" : "git"; } protected override string GenerateCommandLineCommands()