From e9caaa773cbdfeab9a4612fe819b5745e4984e84 Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Wed, 17 Feb 2021 10:58:31 -0800 Subject: [PATCH 1/2] Annotate framework assemblies as trimmable This will opt them into trimming with the behavior described at https://github.com/mono/linker/blob/main/docs/design/trimmed-assemblies.md#assemblymetadataistrimmable-true. --- eng/versioning.targets | 3 +++ .../System.Private.CoreLib/src/Internal/AssemblyAttributes.cs | 1 + 2 files changed, 4 insertions(+) diff --git a/eng/versioning.targets b/eng/versioning.targets index 468f236c5f482..cb293a96eb03c 100644 --- a/eng/versioning.targets +++ b/eng/versioning.targets @@ -20,6 +20,9 @@ True + + True + diff --git a/src/libraries/System.Private.CoreLib/src/Internal/AssemblyAttributes.cs b/src/libraries/System.Private.CoreLib/src/Internal/AssemblyAttributes.cs index 0052cefef04f1..3c0b9479941ce 100644 --- a/src/libraries/System.Private.CoreLib/src/Internal/AssemblyAttributes.cs +++ b/src/libraries/System.Private.CoreLib/src/Internal/AssemblyAttributes.cs @@ -22,5 +22,6 @@ [assembly: AssemblyMetadata("Serviceable", "True")] [assembly: AssemblyMetadata(".NETFrameworkAssembly", "")] +[assembly: AssemblyMetadata("IsTrimmable", "True")] [assembly: NeutralResourcesLanguage("en-US")] From d03327e62ddb7035442c9b803c699d1f8776e1bd Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Thu, 18 Feb 2021 15:11:25 -0800 Subject: [PATCH 2/2] Add a condition to let projects opt out A project just needs to set false, and it won't get the trimmable metadata. I also got rid of the SkipFrameworkAssemblyMetadata check since I don't think the IsTrimmable metadata should be tied to whether we are building a framework assembly, and this property was unused as far as I could tell. --- eng/versioning.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/versioning.targets b/eng/versioning.targets index cb293a96eb03c..e6a3e7d1f0ad7 100644 --- a/eng/versioning.targets +++ b/eng/versioning.targets @@ -20,7 +20,7 @@ True - + True @@ -86,7 +86,7 @@ + Condition="'@(AssemblyMetadata)' != ''"> <_Parameter1>%(AssemblyMetadata.Identity) <_Parameter2>%(AssemblyMetadata.Value)