C# CONCEPTS

How to reduce .Net Core App Size

Application Size Trimming (Ref: C#)

Sukhpinder Singh | .Net Developer
C# Programming
Published in
2 min readSep 3, 2020

--

Photo by Martin Shreder on Unsplash

One of the significant differences between .NET Core and .NET Framework is that .NET Core promotes self-contained deployment, i.e., everything required to run to bundle the application together. It doesn’t rely on having the framework installed separately. The drawback is the size; it pulls along a complete copy of the runtime & framework.

To resolve the size problem, Microsoft has introduced an alternative to cut unused assemblies as part of publishing self-contained applications known as “assembly linker.”

Optionally during the publishing process, a trim phase occurs, which does a walkthrough of the code classes identifying the assemblies that are used. It will then only package required assemblies into the app, thereby reducing the size of the application.

In .NET 5, open the assemblies, and removing the types and members that are not used by the application, further reducing the size.

--

--

Sukhpinder Singh | .Net Developer
C# Programming

Programmer by heart | C# | .Net 6 | .Net 8 | dotnet | dotnetcore | Kubernetes | Angular | AWS | Remember to 👏 Linktree: https://linktr.ee/sukhpindersingh