diff options
author | Jan Kotas <jkotas@microsoft.com> | 2016-10-01 23:56:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-01 23:56:29 +0300 |
commit | 8ae4d04c50691ab7c99f05d9af6fc999b239e913 (patch) | |
tree | 02f6da2fae3768727628fe36a9ca169c1b125e28 /dir.targets | |
parent | e49208a633ba14beebafc072f8bada383c55df14 (diff) |
Redirect git rev-parse HEAD error output (#1967)
Redirect git rev-parse HEAD error output to avoid bogus messages about missing git tool when building inside VS and not having git on the path.
Diffstat (limited to 'dir.targets')
-rw-r--r-- | dir.targets | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/dir.targets b/dir.targets index 532507454..3e7c99ad1 100644 --- a/dir.targets +++ b/dir.targets @@ -18,6 +18,20 @@ <!-- Override corefx multi targeting support --> <Target Name="ConvertCommonMetadataToAdditionalProperties" BeforeTargets="AssignProjectConfiguration" /> + <!-- Remove once we pick up buildtools with the fix - https://github.com/dotnet/buildtools/pull/1082 --> + <!-- Override GetLatestCommitHash with redirected error output to avoid bogus messages + about missing git tool when building inside VS --> + <Target Name="GetLatestCommitHash" Condition="'$(LatestCommit)'==''"> + <Exec Command="git rev-parse HEAD 2>&1" StandardOutputImportance="Low" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" ConsoleToMSBuild="true"> + <Output TaskParameter="ConsoleOutput" PropertyName="LatestCommit" /> + <Output TaskParameter="ExitCode" PropertyName="LatestCommitExitCode" /> + </Exec> + <!-- We shouldn't fail the build if we can't retreive the commit hash, so in this case just set it to N/A --> + <PropertyGroup Condition="'$(LatestCommitExitCode)'!='0'"> + <LatestCommit>N/A</LatestCommit> + </PropertyGroup> + </Target> + <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'"> <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two properties to any folder that exists to skip the GenerateReferenceAssemblyPaths task (not target) and to prevent it from outputting a warning (MSB3644). --> |