From 16b40667278d24a23af0c839f4c277499b3fee19 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Wed, 20 Mar 2024 14:48:07 -0700 Subject: [PATCH] Trim dependencies (#5058) * Trim dependencies - Enable the ReferenceTrimmer analyzer to make sure the dependencies stay clean. Fixes #5046 --------- Co-authored-by: Martin Taillefer --- bench/Directory.Build.targets | 5 +++++ eng/MSBuild/Analyzers.props | 1 + eng/packages/General.props | 1 + src/Analyzers/Directory.Build.targets | 5 +++++ src/Generators/Directory.Build.targets | 5 +++++ .../Microsoft.AspNetCore.Diagnostics.Middleware.csproj | 1 - .../Microsoft.Extensions.Compliance.Testing.csproj | 1 - .../Microsoft.Extensions.Diagnostics.Testing.csproj | 1 + .../Microsoft.Extensions.Http.Diagnostics.csproj | 2 -- .../Microsoft.Extensions.Resilience.csproj | 1 - .../Microsoft.Extensions.Telemetry.Abstractions.csproj | 2 -- .../Microsoft.Extensions.Telemetry.csproj | 2 +- .../Microsoft.Extensions.TimeProvider.Testing.csproj | 2 +- src/Shared/Shared.csproj | 7 +++---- test/Directory.Build.targets | 8 ++++---- .../Unit/Microsoft.Gen.Metrics.Unit.Tests.csproj | 4 +++- .../Microsoft.AspNetCore.HeaderParsing.Tests.csproj | 1 - .../Microsoft.AspNetCore.Testing.Tests.csproj | 1 + ...Microsoft.Extensions.Compliance.Redaction.Tests.csproj | 7 ++++++- .../Microsoft.Extensions.Diagnostics.Probes.Tests.csproj | 2 -- ...Extensions.Diagnostics.ResourceMonitoring.Tests.csproj | 1 + .../Microsoft.Extensions.Http.Diagnostics.Tests.csproj | 1 - .../Microsoft.Extensions.Http.Resilience.Tests.csproj | 6 ------ .../Microsoft.Extensions.Resilience.Tests.csproj | 2 -- .../Microsoft.Extensions.Telemetry.Tests.csproj | 2 -- ...Microsoft.Extensions.TimeProvider.Testing.Tests.csproj | 4 ++++ test/Shared/Shared.Tests.csproj | 1 - 27 files changed, 42 insertions(+), 34 deletions(-) diff --git a/bench/Directory.Build.targets b/bench/Directory.Build.targets index 14437118703..55b2cc7c075 100644 --- a/bench/Directory.Build.targets +++ b/bench/Directory.Build.targets @@ -1,3 +1,8 @@ + + + + $(NoWarn);RT0000 + diff --git a/eng/MSBuild/Analyzers.props b/eng/MSBuild/Analyzers.props index 54d4c5347e2..040e7ecd025 100644 --- a/eng/MSBuild/Analyzers.props +++ b/eng/MSBuild/Analyzers.props @@ -22,6 +22,7 @@ + diff --git a/eng/packages/General.props b/eng/packages/General.props index cd2a0b19b6c..f2440cf2704 100644 --- a/eng/packages/General.props +++ b/eng/packages/General.props @@ -62,6 +62,7 @@ + diff --git a/src/Analyzers/Directory.Build.targets b/src/Analyzers/Directory.Build.targets index 88cbdae86dd..49a5838628a 100644 --- a/src/Analyzers/Directory.Build.targets +++ b/src/Analyzers/Directory.Build.targets @@ -5,4 +5,9 @@ false false + + + + $(NoWarn);RT0000 + diff --git a/src/Generators/Directory.Build.targets b/src/Generators/Directory.Build.targets index 88cbdae86dd..fa161115b87 100644 --- a/src/Generators/Directory.Build.targets +++ b/src/Generators/Directory.Build.targets @@ -5,4 +5,9 @@ false false + + + + $(NoWarn);RT0000 + diff --git a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Microsoft.AspNetCore.Diagnostics.Middleware.csproj b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Microsoft.AspNetCore.Diagnostics.Middleware.csproj index 654e36f481f..5484aa8f5af 100644 --- a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Microsoft.AspNetCore.Diagnostics.Middleware.csproj +++ b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Microsoft.AspNetCore.Diagnostics.Middleware.csproj @@ -40,7 +40,6 @@ - diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj b/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj index 0da536c5c51..ef2fcd70e7f 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj +++ b/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj @@ -21,7 +21,6 @@ - diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.csproj b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.csproj index 5bd030df5e9..618c6ba38ba 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.csproj +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.csproj @@ -29,6 +29,7 @@ + diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj index 223a370cd57..052c54939ba 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj @@ -43,9 +43,7 @@ - - diff --git a/src/Libraries/Microsoft.Extensions.Resilience/Microsoft.Extensions.Resilience.csproj b/src/Libraries/Microsoft.Extensions.Resilience/Microsoft.Extensions.Resilience.csproj index 672833718fc..f1a2eabe129 100644 --- a/src/Libraries/Microsoft.Extensions.Resilience/Microsoft.Extensions.Resilience.csproj +++ b/src/Libraries/Microsoft.Extensions.Resilience/Microsoft.Extensions.Resilience.csproj @@ -31,7 +31,6 @@ - diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Microsoft.Extensions.Telemetry.Abstractions.csproj b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Microsoft.Extensions.Telemetry.Abstractions.csproj index 0e16deda969..08a379be0e6 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Microsoft.Extensions.Telemetry.Abstractions.csproj +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Microsoft.Extensions.Telemetry.Abstractions.csproj @@ -48,8 +48,6 @@ - - diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj b/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj index 95bb8c20fb2..053db6d3e60 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj @@ -34,7 +34,7 @@ - + diff --git a/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/Microsoft.Extensions.TimeProvider.Testing.csproj b/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/Microsoft.Extensions.TimeProvider.Testing.csproj index fd90b9425b8..c18c12b7023 100644 --- a/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/Microsoft.Extensions.TimeProvider.Testing.csproj +++ b/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/Microsoft.Extensions.TimeProvider.Testing.csproj @@ -19,7 +19,7 @@ - + diff --git a/src/Shared/Shared.csproj b/src/Shared/Shared.csproj index ed668a5200b..f6cbb03ea83 100644 --- a/src/Shared/Shared.csproj +++ b/src/Shared/Shared.csproj @@ -26,12 +26,11 @@ - + - - - + + diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets index 47cb284b866..f005ff90cfe 100644 --- a/test/Directory.Build.targets +++ b/test/Directory.Build.targets @@ -13,8 +13,8 @@ - - - - + + + $(NoWarn);RT0000 + diff --git a/test/Generators/Microsoft.Gen.Metrics/Unit/Microsoft.Gen.Metrics.Unit.Tests.csproj b/test/Generators/Microsoft.Gen.Metrics/Unit/Microsoft.Gen.Metrics.Unit.Tests.csproj index a2f36044ae7..4de04ed55f3 100644 --- a/test/Generators/Microsoft.Gen.Metrics/Unit/Microsoft.Gen.Metrics.Unit.Tests.csproj +++ b/test/Generators/Microsoft.Gen.Metrics/Unit/Microsoft.Gen.Metrics.Unit.Tests.csproj @@ -16,7 +16,9 @@ - + + + diff --git a/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/Microsoft.AspNetCore.HeaderParsing.Tests.csproj b/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/Microsoft.AspNetCore.HeaderParsing.Tests.csproj index fc601f47358..57858f96902 100644 --- a/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/Microsoft.AspNetCore.HeaderParsing.Tests.csproj +++ b/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/Microsoft.AspNetCore.HeaderParsing.Tests.csproj @@ -10,7 +10,6 @@ - diff --git a/test/Libraries/Microsoft.AspNetCore.Testing.Tests/Microsoft.AspNetCore.Testing.Tests.csproj b/test/Libraries/Microsoft.AspNetCore.Testing.Tests/Microsoft.AspNetCore.Testing.Tests.csproj index 41cdb91981f..11d60ebbaba 100644 --- a/test/Libraries/Microsoft.AspNetCore.Testing.Tests/Microsoft.AspNetCore.Testing.Tests.csproj +++ b/test/Libraries/Microsoft.AspNetCore.Testing.Tests/Microsoft.AspNetCore.Testing.Tests.csproj @@ -11,5 +11,6 @@ + diff --git a/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/Microsoft.Extensions.Compliance.Redaction.Tests.csproj b/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/Microsoft.Extensions.Compliance.Redaction.Tests.csproj index f17dfac63ad..787cc7d91e8 100644 --- a/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/Microsoft.Extensions.Compliance.Redaction.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/Microsoft.Extensions.Compliance.Redaction.Tests.csproj @@ -7,6 +7,11 @@ - + + + + + + diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj index 5cb8a9f8f62..5f6ca415e12 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj @@ -16,8 +16,6 @@ - - diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests.csproj b/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests.csproj index a1edfd280cf..5f470b1aaf4 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests.csproj @@ -20,5 +20,6 @@ + diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj index 44d17c5b2a4..4bc20735577 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj @@ -25,7 +25,6 @@ - diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj index 44aba460abd..266794186c7 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj @@ -29,14 +29,8 @@ - - - - - - diff --git a/test/Libraries/Microsoft.Extensions.Resilience.Tests/Microsoft.Extensions.Resilience.Tests.csproj b/test/Libraries/Microsoft.Extensions.Resilience.Tests/Microsoft.Extensions.Resilience.Tests.csproj index 67c25dd1e90..163b01082d1 100644 --- a/test/Libraries/Microsoft.Extensions.Resilience.Tests/Microsoft.Extensions.Resilience.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.Resilience.Tests/Microsoft.Extensions.Resilience.Tests.csproj @@ -20,7 +20,6 @@ - @@ -28,7 +27,6 @@ - diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Microsoft.Extensions.Telemetry.Tests.csproj b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Microsoft.Extensions.Telemetry.Tests.csproj index d5e19975a0e..7273b05c6c7 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Microsoft.Extensions.Telemetry.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Microsoft.Extensions.Telemetry.Tests.csproj @@ -17,7 +17,6 @@ - @@ -31,6 +30,5 @@ - diff --git a/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/Microsoft.Extensions.TimeProvider.Testing.Tests.csproj b/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/Microsoft.Extensions.TimeProvider.Testing.Tests.csproj index dc4a5be194b..d0884c2ac5c 100644 --- a/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/Microsoft.Extensions.TimeProvider.Testing.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/Microsoft.Extensions.TimeProvider.Testing.Tests.csproj @@ -7,4 +7,8 @@ + + + + diff --git a/test/Shared/Shared.Tests.csproj b/test/Shared/Shared.Tests.csproj index 3d423d264f9..d7bfa1801e2 100644 --- a/test/Shared/Shared.Tests.csproj +++ b/test/Shared/Shared.Tests.csproj @@ -12,7 +12,6 @@ -