Skip to content

Commit

Permalink
Enable .NET 8 CLI build with _AggressiveAttributeTrimming
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Jul 17, 2023
1 parent 2cf7fba commit 97e91ed
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 0 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "3.0.38"
},
"sdk": {
"version": "7.0.202",
"rollForward": "latestFeature"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@
-->
<OutputType Condition="'$(CI_RUNNER_SAMPLES_INTEGRATION_TESTS)' == 'true'">Exe</OutputType>
<OutputType Condition="'$(CI_RUNNER_SAMPLES_INTEGRATION_TESTS)' != 'true'">WinExe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Platforms>x64;ARM64</Platforms>
<DefineConstants>$(DefineConstants);SAMPLE_APP</DefineConstants>
<NoWarn>$(NoWarn);CA1416</NoWarn>
<AssemblyName>computesharp.cli</AssemblyName>

<!-- When explicitly optimizing for size, strip the icon (which adds about 100 KB of binary size) -->
<ApplicationIcon Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED)' != 'true'">..\..\assets\icon.ico</ApplicationIcon>
<RestoreSources>
https://api.nuget.org/v3/index.json;
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json;
</RestoreSources>
</PropertyGroup>

<!--
Expand All @@ -27,14 +31,15 @@
-->
<PropertyGroup Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT)' == 'true'">
<PublishAot>true</PublishAot>
<DebuggerSupport>false</DebuggerSupport>
<UseSystemResourceKeys>true</UseSystemResourceKeys>
<InvariantGlobalization>true</InvariantGlobalization>
<OptimizationPreference Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED)' == 'true'">Size</OptimizationPreference>
<OptimizationPreference Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED)' != 'true'">Speed</OptimizationPreference>
<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
<IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
<IlcDisableReflection Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_DISABLE_REFLECTION)' == 'true'">true</IlcDisableReflection>
<IlcOptimizationPreference Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED)' == 'true'">Size</IlcOptimizationPreference>
<IlcOptimizationPreference Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED)' != 'true'">Speed</IlcOptimizationPreference>
<NullabilityInfoContextSupport>false</NullabilityInfoContextSupport>
<_AggressiveAttributeTrimming>true</_AggressiveAttributeTrimming>
</PropertyGroup>

<!--
Expand Down
2 changes: 1 addition & 1 deletion src/ComputeSharp.Core/ComputeSharp.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/ComputeSharp/ComputeSharp.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<SupportedOSVersion>windows6.2</SupportedOSVersion>
</PropertyGroup>

Expand All @@ -18,7 +18,7 @@
</ItemGroup>

<!-- .NET 6 uses the NuGet package for TerraFX -->
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="TerraFX.Interop.Windows" Version="10.0.22621.2" />
</ItemGroup>

Expand All @@ -30,7 +30,7 @@
</ItemGroup>

<!-- Include the ILLink file on the .NET 6 target (to properly trim configuration switches in publish builds) -->
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<EmbeddedResource Include="Properties\ILLink.Substitutions.xml" LogicalName="ILLink.Substitutions.xml" />
</ItemGroup>

Expand Down

0 comments on commit 97e91ed

Please sign in to comment.