Directory.build.targets 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <Project>
  2. <!-- This props all need to be set in targets as they depend on the values set earlier -->
  3. <PropertyGroup>
  4. <Product>$(AssemblyName) ($(TargetFramework))</Product>
  5. </PropertyGroup>
  6. <PropertyGroup Condition="'$(TargetFramework)' == 'net472'">
  7. <DefineConstants>$(DefineConstants);HAS_WINFORMS;HAS_WPF;HAS_WINRT;HAS_DISPATCHER;HAS_REMOTING;DESKTOPCLR;NO_NULLABLE_ATTRIBUTES</DefineConstants>
  8. </PropertyGroup>
  9. <PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.18362'">
  10. <DefineConstants>$(DefineConstants);HAS_WINRT;WINDOWS;HAS_OS_XAML;LEGACY_WINRT;NO_NULLABLE_ATTRIBUTES</DefineConstants>
  11. <TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
  12. </PropertyGroup>
  13. <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
  14. <DefineConstants>$(DefineConstants);HAS_WINRT;NO_NULLABLE_ATTRIBUTES</DefineConstants>
  15. </PropertyGroup>
  16. <PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0')) or $(TargetFramework.StartsWith('net7.0'))">
  17. <DefineConstants>$(DefineConstants);HAS_TRIMMABILITY_ATTRIBUTES</DefineConstants>
  18. </PropertyGroup>
  19. <PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-windows')) or $(TargetFramework.StartsWith('net7.0-windows'))">
  20. <DefineConstants>$(DefineConstants);HAS_WINRT;HAS_WINFORMS;HAS_WPF;HAS_DISPATCHER;DESKTOPCLR;WINDOWS;CSWINRT</DefineConstants>
  21. </PropertyGroup>
  22. <ItemGroup Condition="'$(TargetFramework)' == 'net472' or '$(TargetFramework)' == 'uap10.0.18362' or '$(TargetFramework)' == 'netstandard2.0'">
  23. <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
  24. </ItemGroup>
  25. <Target Name="AddCommitHashToAssemblyAttributes" BeforeTargets="GetAssemblyAttributes">
  26. <ItemGroup>
  27. <AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition=" '$(SourceRevisionId)' != '' ">
  28. <_Parameter1>CommitHash</_Parameter1>
  29. <_Parameter2>$(SourceRevisionId)</_Parameter2>
  30. </AssemblyAttribute>
  31. </ItemGroup>
  32. </Target>
  33. <!-- Remove once coverlet supports this built-in -->
  34. <Target Name="CoverletGetPathMap"
  35. DependsOnTargets="InitializeSourceRootMappedPaths"
  36. Returns="@(_LocalTopLevelSourceRoot)"
  37. Condition="'$(DeterministicSourcePaths)' == 'true'">
  38. <ItemGroup>
  39. <_LocalTopLevelSourceRoot Include="@(SourceRoot)" Condition="'%(SourceRoot.NestedRoot)' == ''"/>
  40. </ItemGroup>
  41. </Target>
  42. </Project>