dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.27k stars 5.9k forks source link

Prepare .NET libraries for trimming: Add multi-targeting H2 with our recommendations #36730

Open Rick-Anderson opened 1 year ago

Rick-Anderson commented 1 year ago

See this comment copied below

Finally, recently we've learned that multi-targeting is not only very common, but basically a must have when enabling trimming. (This is based on experience trying to make some NuGets trim compatible). I think the document should have a section about the multi-targeting and our recommendations around it. But the core point is that very few libraries will only target latest TFM. By far the most common case is either library targets netstandard2.0 or it multi-targets net472, netstandard2.0 and net6.0 (or some combination of these).


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

sbomer commented 1 year ago

Leaving a note here to mention the new behavior in the <IsTrimmable>true</IsTrimmable> part of https://learn.microsoft.com/dotnet/core/deploying/trimming/prepare-libraries-for-trimming.

sbomer commented 1 year ago

I'm adding a breaking change notice that mentions multi-targeting: https://github.com/dotnet/docs/pull/36775. We still need a dedicated section in the general trimming docs though. When that's added, we should also link to it from the breaking change notice.