Skip to content

Commit 0ae8bb7

Browse files
committed
Centralize trimming settings in common .targets file
1 parent f9bb4a4 commit 0ae8bb7

File tree

5 files changed

+7
-14
lines changed

5 files changed

+7
-14
lines changed

CommunityToolkit.Common/CommunityToolkit.Common.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414
<PackageTags>Incremental;Loading;Collection;IncrementalLoadingCollection;String;Array;Extensions;Helpers</PackageTags>
1515
</PropertyGroup>
1616

17-
<!-- .NET Standard 2.1 and .NET 6 already have [NotNullIfNotNull] and [NotNullWhen].
18-
Additionally, also enable trimming support on .NET 6. -->
17+
<!-- .NET Standard 2.1 and .NET 6 already have [NotNullIfNotNull] and [NotNullWhen] -->
1918
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
2019
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
21-
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
22-
<IsTrimmable>true</IsTrimmable>
2320
</PropertyGroup>
2421

2522
</Project>

CommunityToolkit.Diagnostics/CommunityToolkit.Diagnostics.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
<When Condition="'$(TargetFramework)' == 'net6.0'">
3939
<PropertyGroup>
4040
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
41-
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
42-
<IsTrimmable>true</IsTrimmable>
4341
</PropertyGroup>
4442
</When>
4543
</Choose>

CommunityToolkit.HighPerformance/CommunityToolkit.HighPerformance.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151
Additionally, also enable trimming support on .NET 6. -->
5252
<PropertyGroup>
5353
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
54-
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
55-
<IsTrimmable>true</IsTrimmable>
5654
</PropertyGroup>
5755
</When>
5856

CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@
3434
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
3535
</ItemGroup>
3636

37-
<!-- Enable trimming support on .NET 6 -->
38-
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
39-
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
40-
<IsTrimmable>true</IsTrimmable>
41-
</PropertyGroup>
42-
4337
<!-- Reference the various multi-targeted versions of the source generator project (one per Roslyn version) -->
4438
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
4539
<ProjectReference Include="..\CommunityToolkit.Mvvm.SourceGenerators.Roslyn401\CommunityToolkit.Mvvm.SourceGenerators.Roslyn401.csproj" ReferenceOutputAssembly="false" />

build/Community.Toolkit.Common.targets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,10 @@
1717
<None Include="$(RepositoryDirectory)ThirdPartyNotices.txt" Pack="true" PackagePath="\" Visible="False" />
1818
</ItemGroup>
1919

20+
<!-- Configure trimming for core projects on .NET 6 and above -->
21+
<PropertyGroup Condition="'$(IsCoreProject)' == 'true' AND ('$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0')">
22+
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
23+
<IsTrimmable>true</IsTrimmable>
24+
</PropertyGroup>
25+
2026
</Project>

0 commit comments

Comments
 (0)