Skip to content

Commit

Permalink
Tweak logic to generate supported OS attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Sep 9, 2024
1 parent e4c419d commit 1b355fe
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<SupportedOSVersion>windows6.1</SupportedOSVersion>
<SupportedOSPlatformVersion>6.1</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<SupportedOSVersion>windows6.2</SupportedOSVersion>
<SupportedOSPlatformVersion>6.2</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ComputeSharp.Dxc/ComputeSharp.Dxc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Platforms>AnyCPU;x64;ARM64</Platforms>
<SupportedOSVersion>windows6.2</SupportedOSVersion>
<SupportedOSPlatformVersion>6.2</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ComputeSharp.Pix/ComputeSharp.Pix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Platforms>AnyCPU;x64;ARM64</Platforms>
<SupportedOSVersion>windows6.2</SupportedOSVersion>
<SupportedOSPlatformVersion>6.2</SupportedOSPlatformVersion>
</PropertyGroup>

<!-- Reference to the main library-->
Expand Down
2 changes: 1 addition & 1 deletion src/ComputeSharp/ComputeSharp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<SupportedOSVersion>windows6.2</SupportedOSVersion>
<SupportedOSPlatformVersion>6.2</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
12 changes: 9 additions & 3 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,18 @@
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
</PropertyGroup>

<!-- Emit the [SupportedOSVersion] attribute if needed -->
<!--
Emit the [SupportedOSVersion] attribute if needed. Note that the .NET SDK already emits this attribute
automatically, but only when targeting the Windows TFM. We use this custom target to emit the same
attribute for projects only targeting plain .NET as well. This makes them easier to consume from
projects that are not using the Windows TFM as well. Doing so isn't strictly needed anyway unless
you're specifically consuming the Windows SDK projections, which those projects are not doing.
-->
<Target Name="EmitSupportedOSVersionAttributeForTargetOS"
BeforeTargets="PrepareForBuild">
<ItemGroup Condition="'$(SupportedOSVersion)' != ''">
<ItemGroup Condition="'$(SupportedOSPlatformVersion)' != '' AND !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0-windows'))">
<AssemblyAttribute Include="System.Runtime.Versioning.SupportedOSPlatformAttribute">
<_Parameter1>$(SupportedOSVersion)</_Parameter1>
<_Parameter1>Windows$(SupportedOSPlatformVersion)</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Target>
Expand Down

0 comments on commit 1b355fe

Please sign in to comment.