From 9cf2d74c8be05d55c598a36b2ca49d77f30ac9d5 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Tue, 13 Dec 2016 16:10:39 -0800 Subject: [PATCH] Work around msbuild bug that blocks git tool tasks in VS2017 prompt --- build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs | 5 ++++- build_projects/dotnet-cli-build/GetCommitHash.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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()