diff options
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). --> |