-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
✔️ Resolution: DuplicateResolved as a duplicate of another issueResolved as a duplicate of another issueStatus: Resolved
Description
When using the TrimMode=Link publish option, none of the ASP.NET Core assemblies are affected. They all remain at their full size even if members within those assemblies are never accessed by a code path in the application.
Because of the quantity and size of the ASP.NET Core assemblies, there is a big opportunity to reduce the size of a deployed app if these assemblies participated in member-level trimming.
As an example, this sample ASP.NET Core application has the following trimmed container image sizes on Alpine Linux:
| TrimMode | Size |
|---|---|
| <Default> | 98.5 MB |
| Link | 80 MB |
If the ASP.NET Core assemblies participated in assembly-level trimming, this reduction would be even greater.
Repro steps:
git clone https://github.com/dotnet/dotnet-docker.gitcd dotnet-docker/samples/aspnetappdocker build -t default-trimming -f Dockerfile.alpine-x64-slim .- Modify
Dockerfile.alpine-x64-slimto include/p:TrimMode=Linkin thedotnet publishcall docker build -t link-trimming -f Dockerfile.alpine-x64-slim .docker inspect --format "{{ .Size }}" default-trimmingdocker inspect --format "{{ .Size }}" link-trimming
Metadata
Metadata
Assignees
Labels
✔️ Resolution: DuplicateResolved as a duplicate of another issueResolved as a duplicate of another issueStatus: Resolved