Directory.build.targets 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <Project>
  2. <!-- Workaround. Remove once we're on 3.1.300+
  3. https://github.com/dotnet/sourcelink/issues/572 -->
  4. <PropertyGroup>
  5. <TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
  6. </PropertyGroup>
  7. <ItemGroup>
  8. <EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/>
  9. </ItemGroup>
  10. <!-- This props all need to be set in targets as they depend on the values set earlier -->
  11. <PropertyGroup>
  12. <Product>$(AssemblyName) ($(TargetFramework))</Product>
  13. </PropertyGroup>
  14. <PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
  15. <DefineConstants>$(DefineConstants);HAS_WINFORMS;HAS_WINRT;HAS_DISPATCHER;HAS_REMOTING;DESKTOPCLR</DefineConstants>
  16. </PropertyGroup>
  17. <PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0'">
  18. <TargetPlatformVersion>10.0.17763.0</TargetPlatformVersion>
  19. <TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
  20. <DefineConstants>$(DefineConstants);HAS_WINRT;NO_CODE_COVERAGE_ATTRIBUTE;NO_SERIALIZABLE;CRIPPLED_REFLECTION;NO_THREAD;NO_TRACE;WINDOWS</DefineConstants>
  21. </PropertyGroup>
  22. <PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.16299'">
  23. <DefineConstants>$(DefineConstants);HAS_WINRT;WINDOWS</DefineConstants>
  24. <TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
  25. </PropertyGroup>
  26. <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.1'">
  27. <DefineConstants>$(DefineConstants);HAS_WINRT</DefineConstants>
  28. </PropertyGroup>
  29. <PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
  30. <DefineConstants>$(DefineConstants);HAS_WINRT;HAS_WINFORMS;HAS_DISPATCHER;DESKTOPCLR</DefineConstants>
  31. </PropertyGroup>
  32. <PropertyGroup Condition="$(TargetFramework.StartsWith('net5.0-windows'))">
  33. <DefineConstants>$(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING;HAS_WINFORMS;HAS_DISPATCHER;DESKTOPCLR;WINDOWS</DefineConstants>
  34. </PropertyGroup>
  35. <PropertyGroup Condition="'$(TargetFramework)' == 'net5.0'">
  36. <DefineConstants>$(DefineConstants);HAS_TRACE;PREFER_ASYNC;HAS_TPL46;NO_REMOTING</DefineConstants>
  37. </PropertyGroup>
  38. <ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
  39. <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
  40. </ItemGroup>
  41. <Target Name="AddCommitHashToAssemblyAttributes" BeforeTargets="GetAssemblyAttributes">
  42. <ItemGroup>
  43. <AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition=" '$(SourceRevisionId)' != '' ">
  44. <_Parameter1>CommitHash</_Parameter1>
  45. <_Parameter2>$(SourceRevisionId)</_Parameter2>
  46. </AssemblyAttribute>
  47. </ItemGroup>
  48. </Target>
  49. </Project>