Skip to content

Commit

Permalink
Annotate framework assemblies as trimmable (#48428)
Browse files Browse the repository at this point in the history
* 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.

* Add a condition to let projects opt out

A project just needs to set <SetIsTrimmable>false</SetIsTrimmable>, 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.
  • Loading branch information
sbomer authored Feb 19, 2021
1 parent e53803d commit 09a1256
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion eng/versioning.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<AssemblyMetadata Include="PreferInbox">
<Value>True</Value>
</AssemblyMetadata>
<AssemblyMetadata Include="IsTrimmable" Condition="'$(SetIsTrimmable)' != 'false'">
<Value>True</Value>
</AssemblyMetadata>
</ItemGroup>

<!-- Adds SupportedOSPlatform attribute for Windows Specific libraries -->
Expand Down Expand Up @@ -83,7 +86,7 @@
</AssemblyAttribute>

<AssemblyAttribute Include="System.Reflection.AssemblyMetadata"
Condition="'$(SkipFrameworkAssemblyMetadata)' != 'true' and '@(AssemblyMetadata)' != ''">
Condition="'@(AssemblyMetadata)' != ''">
<_Parameter1>%(AssemblyMetadata.Identity)</_Parameter1>
<_Parameter2>%(AssemblyMetadata.Value)</_Parameter2>
</AssemblyAttribute>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@

[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("IsTrimmable", "True")]

[assembly: NeutralResourcesLanguage("en-US")]

0 comments on commit 09a1256

Please sign in to comment.