SteamRE / SteamKit

SteamKit2 is a .NET library designed to interoperate with Valve's Steam network. It aims to provide a simple, yet extensible, interface to perform various actions on the network.
GNU Lesser General Public License v2.1
2.56k stars 489 forks source link

Provide trimming annotations for self-contained apps #1057

Open yaakov-h opened 2 years ago

yaakov-h commented 2 years ago

.NET 5 previewed the ability to trim unused code from applications and from the runtime, and .NET 6 now makes that generally available.

Relevant docs are here: https://docs.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained

Considering how many protobuf messages we ship that most apps won't use, this is quite valuable. DepotDownloader can trim about 4.5-5 MB away from SteamKit2.dll and a fully self-contained trimmed build of DD is about 15-20MB IIRC.

Related issues:

Some initial prototyping has already been done in this pull request:

yaakov-h commented 2 years ago

We may have to switch to the Google.Protobuf library which isn't reflection-based in order to (a) get this working properly, and (b) be able to run in an AOT environment such as what is being planned at the moment for .NET 7.

🤔