From 0ac99a58d64da59ce2f0ab91578d4c3df41531f2 Mon Sep 17 00:00:00 2001
From: Sven Boemer <sbomer@gmail.com>
Date: Wed, 23 Nov 2022 09:03:32 -0800
Subject: [PATCH] Limit impact of global NoWarn (#3127)

---
 src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets b/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets
index 108c5c25bd63..8330d0718133 100644
--- a/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets
+++ b/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets
@@ -64,7 +64,7 @@ Copyright (c) .NET Foundation. All rights reserved.
   </PropertyGroup>
 
   <!-- Disable Redundant Warning Suppressions by default-->
-  <PropertyGroup Condition="'$(_TrimmerShowRedundantSuppressions)' != 'true'">
+  <PropertyGroup Condition="'$(_TrimmerShowRedundantSuppressions)' != 'true' And '$(PublishTrimmed)' == 'true'">
     <NoWarn>$(NoWarn);IL2121</NoWarn>
   </PropertyGroup>