Clean up dead code in illink targets (#85741)
authorSven Boemer <sbomer@gmail.com>
Tue, 16 May 2023 20:36:48 +0000 (13:36 -0700)
committerGitHub <noreply@github.com>
Tue, 16 May 2023 20:36:48 +0000 (13:36 -0700)
Removes TFM version checks, and adds a warning when using
explicit ILLink package reference.

We reference ILLink as a packagereference that versions with the
runtime, so the 8.0 linker is only supported when targeting
`net8.0`, and we can remove the TFM checks. We don't want to
support someone adding a PackageReference to an 8.0 linker, while
targeting an older TFM, in an attempt to get newer linker bits
but with settings that were closer to what we shipped with that
TFM.

---------

Co-authored-by: Marek Safar <marek.safar@gmail.com>
Co-authored-by: Vitek Karas <10670590+vitek-karas@users.noreply.github.com>
src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets
src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj
src/tools/illink/src/ILLink.Tasks/build/6.0_suppressions.xml [deleted file]
src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets

index 9b4a6b8..43cdfe8 100644 (file)
@@ -43,7 +43,7 @@
   <Target Name="GenerateILCompilerExplicitPackageReferenceWarning" Condition="'$(SuppressGenerateILCompilerExplicitPackageReferenceWarning)' == '' and '$(ILCompilerTargetsPath)' != ''"
       BeforeTargets="ImportRuntimeIlcPackageTarget">
     <Warning Condition="'%(PackageReference.Identity)' == 'Microsoft.DotNet.ILCompiler' And '%(PackageReference.IsImplicitlyDefined)' != 'true'"
-             Text="Delete explicit 'Microsoft.DotNet.ILCompiler' package reference in your project file. Explicit 'Microsoft.DotNet.ILCompiler' package reference can run into version errors." />
+             Text="Delete explicit 'Microsoft.DotNet.ILCompiler' package reference in your project file to avoid versioning problems." />
   </Target>
 
   <!-- Locate the runtime package according to the current target runtime -->
index 585ac72..ff511c3 100644 (file)
@@ -28,7 +28,6 @@
     <!-- Note: 'build/Microsoft.NET.ILLink.targets' should not match the package name, because we don't want the targets
          to be imported by nuget. The SDK will import them in the right order. -->
     <None Include="**\*.props;**\*.targets" Pack="true" PackagePath="%(RecursiveDir)%(Filename)%(Extension)" />
-    <None Include="build/6.0_suppressions.xml" Pack="true" PackagePath="build/" />
     <None Include="..\ILLink.RoslynAnalyzer\Microsoft.NET.ILLink.Analyzers.props" Pack="true" PackagePath="build/" />
   </ItemGroup>
 
diff --git a/src/tools/illink/src/ILLink.Tasks/build/6.0_suppressions.xml b/src/tools/illink/src/ILLink.Tasks/build/6.0_suppressions.xml
deleted file mode 100644 (file)
index 7483041..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<linker>
-  <assembly fullname="System.Private.CoreLib">
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2070</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Reflection.CustomAttribute.AddCustomAttributes(System.RuntimeType.ListBuilder{System.Object}@,System.Reflection.RuntimeModule,System.Int32,System.RuntimeType,System.Boolean,System.RuntimeType.ListBuilder{System.Object})</property>
-      <property name="Justification">Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762</property>
-    </attribute>
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2063</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.RuntimeType.GetInterface(System.String,System.Boolean)</property>
-      <property name="Justification">Suppressed in 7.0 for dataflow improvements: https://github.com/dotnet/runtime/commit/2e353d18b81732133aadbee888a801fd9f935fbf</property>
-    </attribute>
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2067</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter(System.RuntimeType,System.RuntimeType,System.RuntimeType)</property>
-      <property name="Justification">Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762</property>
-    </attribute>
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2067</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter(System.RuntimeType,System.RuntimeType)</property>
-      <property name="Justification">Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762</property>
-    </attribute>
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2068</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Reflection.Emit.TypeBuilder.CreateTypeNoLock</property>
-      <property name="Justification">Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762</property>
-    </attribute>
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2069</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Reflection.Emit.TypeBuilder.CreateTypeNoLock</property>
-      <property name="Justification">Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762</property>
-    </attribute>
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2119</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Diagnostics.Tracing.EventSource.WriteEventString(System.String)</property>
-      <property name="Justification">Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea</property>
-    </attribute>
-  </assembly>
-
-  <assembly fullname="System.ComponentModel.Annotations">
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2068</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.ComponentModel.DataAnnotations.AssociatedMetadataTypeTypeDescriptor.TypeDescriptorCache.GetAssociatedMetadataType(System.Type)</property>
-      <property name="Justification">Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762</property>
-    </attribute>
-  </assembly>
-
-  <assembly fullname="System.Data.Common">
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2060</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Data.DataRowExtensions.UnboxT`1.Create()</property>
-      <property name="Justification">Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05</property>
-    </attribute>
-  </assembly>
-
-  <assembly fullname="System.Reflection.Metadata">
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2070</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Reflection.CustomAttribute.AddCustomAttributes(System.RuntimeType.ListBuilder`1@,System.Reflection.RuntimeModule,System.Int32,System.RuntimeType,System.Bool,System.RuntimeType.ListBuilder{System.Object})</property>
-      <property name="Justification">Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762</property>
-    </attribute>
-  </assembly>
-
-  <assembly fullname="System.Diagnostics.DiagnosticSource">
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2119</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Diagnostics.DiagnosticSourceEventSource.FilterAndTransform.#ctor(System.String,System.Int32,System.Int32,System.Diagnostics.DiagnosticSourceEventSource,System.Diagnostics.DiagnosticSourceEventSource.FilterAndTransform)</property>
-      <property name="Justification">Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea</property>
-    </attribute>
-  </assembly>
-
-  <assembly fullname="System.Runtime.Serialization.Formatters">
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2065</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(System.Type)</property>
-      <property name="Justification">Suppressed in 7.0 for dataflow improvements: https://github.com/dotnet/runtime/commit/2e353d18b81732133aadbee888a801fd9f935fbf</property>
-    </attribute>
-  </assembly>
-
-  <assembly fullname="System.Text.Json">
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2055</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Text.Json.Serialization.Converters.FSharpTypeConverterFactory.CreateConverter(System.Type,System.Text.Json.JsonSerializerOptions)</property>
-      <property name="Justification">Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05</property>
-    </attribute>
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2070</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Text.Json.Serialization.Converters.EnumConverterFactory.GetEnumConverterType(System.Type)</property>
-      <property name="Justification">Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05</property>
-    </attribute>
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2070</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Text.Json.Serialization.Converters.NullableConverterFactory.GetNullableConverterType(System.Type)</property>
-      <property name="Justification">Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05</property>
-    </attribute>
-  </assembly>
-
-  <assembly fullname="System.Private.Xml">
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2118</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Xml.Serialization.TypeScope.#cctor</property>
-      <property name="Justification">Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea</property>
-    </attribute>
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2118</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Xml.Serialization.TypeScope.AddSoapEncodedTypes(System.String)</property>
-      <property name="Justification">Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea</property>
-    </attribute>
-  </assembly>
-
-  <assembly fullname="System.Private.DataContractSerialization">
-    <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
-      <argument>ILLink</argument>
-      <argument>IL2118</argument>
-      <property name="Scope">member</property>
-      <property name="Target">M:System.Runtime.Serialization.DateTimeDataContract.#ctor</property>
-      <property name="Justification">Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea</property>
-    </attribute>
-  </assembly>
-
-</linker>
\ No newline at end of file
index b46c700..4ae285b 100644 (file)
@@ -31,8 +31,7 @@ Copyright (c) .NET Foundation. All rights reserved.
       switches can flow to the runtimeconfig.json. Features are disabled
       by default since they may require assemblies, types or members that
       could be removed by the ILLink, causing a trimmed app to crash. -->
-  <PropertyGroup Condition="'$(PublishTrimmed)' == 'true' And
-                            $([MSBuild]::VersionGreaterThanOrEquals($(_TargetFrameworkVersionWithoutV), '6.0'))">
+  <PropertyGroup Condition="'$(PublishTrimmed)' == 'true'">
     <StartupHookSupport Condition="'$(StartupHookSupport)' == ''">false</StartupHookSupport>
     <CustomResourceTypesSupport Condition="'$(CustomResourceTypesSupport)' == ''">false</CustomResourceTypesSupport>
     <EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization Condition="'$(EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization)' == ''">false</EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization>
@@ -49,8 +48,6 @@ Copyright (c) .NET Foundation. All rights reserved.
 
 
   <PropertyGroup Condition="'$(SuppressTrimAnalysisWarnings)' == '' And '$(PublishTrimmed)' == 'true' And '$(EnableTrimAnalyzer)' != 'true'">
-    <!-- Trim analysis warnings are suppressed for .NET < 6. -->
-    <SuppressTrimAnalysisWarnings Condition="$([MSBuild]::VersionLessThan('$(TargetFrameworkVersion)', '6.0'))">true</SuppressTrimAnalysisWarnings>
     <!-- Suppress for WPF/WinForms -->
     <SuppressTrimAnalysisWarnings Condition="'$(UseWpf)' == 'true' Or '$(UseWindowsForms)' == 'true'">true</SuppressTrimAnalysisWarnings>
     <!-- Otherwise, for .NET 6+, warnings are on by default -->
@@ -80,7 +77,7 @@ Copyright (c) .NET Foundation. All rights reserved.
   <Target Name="ILLink"
           Condition=" '$(PublishTrimmed)' == 'true' And
                       '$(RunILLink)' != 'false' And
-                      '$(_TargetFrameworkVersionWithoutV)' >= '3.0' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp' "
+                      '$(TargetFrameworkIdentifier)' == '.NETCoreApp' "
           DependsOnTargets="_RunILLink">
 
     <NETSdkError Condition="'$(_ILLinkExitCode)' != '' And '$(_ILLinkExitCode)' != '0'" ResourceName="ILLinkFailed" />
@@ -195,6 +192,10 @@ Copyright (c) .NET Foundation. All rights reserved.
          is a NativeAOT app, value of SelfContained doesn't matter. -->
     <NETSdkError Condition="'$(RunILLink)' != 'false' And '$(SelfContained)' != 'true'" ResourceName="ILLinkNotSupportedError" />
 
+    <Warning Condition="'$(SuppressILLinkExplicitPackageReferenceWarning)' != 'true' And
+                        '%(PackageReference.Identity)' == 'Microsoft.NET.ILLink.Tasks' And '%(PackageReference.IsImplicitlyDefined)' != 'true'"
+             Text="Delete explicit 'Microsoft.NET.ILLink.Tasks' package reference in your project file to avoid versioning problems." />
+
     <PropertyGroup Condition=" '$(ILLinkWarningLevel)' == '' ">
       <ILLinkWarningLevel Condition=" '$(EffectiveAnalysisLevel)' != '' And
                                        $([MSBuild]::VersionGreaterThanOrEquals($(EffectiveAnalysisLevel), '5.0')) ">5</ILLinkWarningLevel>
@@ -202,28 +203,16 @@ Copyright (c) .NET Foundation. All rights reserved.
     </PropertyGroup>
 
     <!-- In .NET 7, TrimmerDefaultAction is deprecated. TrimMode can be used for the supported configurations. -->
-    <Warning Condition="'$(TrimmerDefaultAction)' != '' And $([MSBuild]::VersionGreaterThan('$(TargetFrameworkVersion)', '6.0'))"
-             Text="Property 'TrimmerDefaultAction' is deprecated in .NET 7 and will be ignored. Use TrimMode instead." />
-
-    <!-- Use a sidecar file to suppress warnings when targeting net6.0, for changes that added or changed warnings. -->
-    <ItemGroup Condition="$([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0'))">
-      <_ILLinkSuppressions Include="$(MSBuildThisFileDirectory)6.0_suppressions.xml" />
-    </ItemGroup>
+    <Warning Condition="'$(TrimmerDefaultAction)' != ''"
+             Text="Property 'TrimmerDefaultAction' is deprecated in .NET 7 and higher and will be ignored. Use TrimMode instead." />
 
     <PropertyGroup Condition="'@(_ILLinkSuppressions->Count())' != '0'">
       <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --link-attributes "@(_ILLinkSuppressions->'%(Identity)', '" --link-attributes "')"</_ExtraTrimmerArgs>
     </PropertyGroup>
 
-    <!-- Set up TrimMode and TrimmerDefaultAction. -->
+    <!-- Set up TrimMode. -->
     <PropertyGroup>
-      <TrimMode Condition="'$(TrimMode)' == '' And $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '6.0'))">copyused</TrimMode>
-      <TrimMode Condition="'$(TrimMode)' == '' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0'))">partial</TrimMode>
       <TrimMode Condition="'$(TrimMode)' == ''">full</TrimMode>
-
-      <!-- Set TrimmerDefaultAction for compat in < 7.0 -->
-      <_TrimmerDefaultAction Condition="$([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '7.0'))">$(TrimmerDefaultAction)</_TrimmerDefaultAction>
-      <_TrimmerDefaultAction Condition="'$(_TrimmerDefaultAction)' == '' And $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '6.0'))">$(TrimMode)</_TrimmerDefaultAction>
-      <_TrimmerDefaultAction Condition="'$(_TrimmerDefaultAction)' == '' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0'))">copy</_TrimmerDefaultAction>
     </PropertyGroup>
 
     <PropertyGroup>
@@ -232,22 +221,6 @@ Copyright (c) .NET Foundation. All rights reserved.
       <TrimmerSingleWarn Condition=" '$(TrimmerSingleWarn)' == '' ">true</TrimmerSingleWarn>
     </PropertyGroup>
 
-   <!-- Suppressions to work around issues in previous versions of the framework. See https://github.com/dotnet/runtime/issues/40336 -->
-    <PropertyGroup Condition="'$(SuppressTrimAnalysisWarnings)' == 'true' And $([MSBuild]::VersionLessThan('$(TargetFrameworkVersion)', '6.0'))">
-      <!-- Framework embedded XML descriptors reference windows-only members. -->
-      <NoWarn Condition=" !$(RuntimeIdentifier.StartsWith('win')) ">$(NoWarn);IL2008</NoWarn> <!-- Unresolved type referenced in XML. -->
-      <NoWarn Condition=" !$(RuntimeIdentifier.StartsWith('win')) ">$(NoWarn);IL2009</NoWarn> <!-- Unresolved member on type referenced in XML. -->
-      <!-- Framework has DynamicDependencyAttributes that reference windows-only members. -->
-      <NoWarn Condition=" !$(RuntimeIdentifier.StartsWith('win')) ">$(NoWarn);IL2037</NoWarn> <!-- Unresolved member for DynamicDependencyAttribute -->
-      <!-- Framework embedded XML descriptors reference 32-bit-only members. -->
-      <NoWarn Condition=" '$(PlatformTarget)' != 'x64' AND '$(PlatformTarget)' != 'arm64'">$(NoWarn);IL2009;IL2012</NoWarn> <!-- Unresolved field referenced in XML -->
-    </PropertyGroup>
-
-    <!-- Enable serialization discovery for compat in < 7.0 -->
-    <PropertyGroup Condition="$([MSBuild]::VersionLessThan('$(TargetFrameworkVersion)', '7.0'))">
-      <_ExtraTrimmerArgs>--enable-serialization-discovery $(_ExtraTrimmerArgs)</_ExtraTrimmerArgs>
-    </PropertyGroup>
-
     <!-- Set a default value for TrimmerRemoveSymbols unless set explicitly. -->
     <PropertyGroup Condition=" '$(TrimmerRemoveSymbols)' == '' ">
       <!-- The default is to remove symbols when debugger support is disabled, and keep them otherwise. -->
@@ -255,12 +228,6 @@ Copyright (c) .NET Foundation. All rights reserved.
       <TrimmerRemoveSymbols Condition=" '$(DebuggerSupport)' != 'false' ">false</TrimmerRemoveSymbols>
     </PropertyGroup>
 
-    <PropertyGroup Condition="'$(_TrimmerUnreachableBodies)' == '' And
-                              '$(PublishTrimmed)' == 'true' And
-                              $([MSBuild]::VersionLessThan($(_TargetFrameworkVersionWithoutV), '6.0'))">
-      <_TrimmerUnreachableBodies>false</_TrimmerUnreachableBodies>
-    </PropertyGroup>
-
     <!-- Set IsTrimmable for any assemblies that already have customized TrimMode. -->
     <ItemGroup>
       <ManagedAssemblyToLink Condition=" '%(ManagedAssemblyToLink.TrimMode)' != '' ">
@@ -284,14 +251,6 @@ Copyright (c) .NET Foundation. All rights reserved.
       <TrimmerRootAssembly Include="@(IntermediateAssembly)" RootMode="EntryPoint" />
     </ItemGroup>
 
-    <!-- For .NET < 6, root and copy assemblies without IsTrimmable=true MSBuild metadata. -->
-    <ItemGroup Condition=" $([MSBuild]::VersionLessThan('$(TargetFrameworkVersion)', '6.0')) ">
-      <TrimmerRootAssembly Include="@(ManagedAssemblyToLink)" Condition=" '%(ManagedAssemblyToLink.IsTrimmable)' != 'true' " />
-      <ManagedAssemblyToLink Condition=" '%(ManagedAssemblyToLink.IsTrimmable)' != 'true' ">
-        <TrimMode>copy</TrimMode>
-      </ManagedAssemblyToLink>
-    </ItemGroup>
-
     <ItemGroup>
       <!-- Don't collapse to a single warning for the intermediate assembly.
            This just sets metadata on the items in ManagedAssemblyToLink that came from IntermediateAssembly. -->