dotnet-daily-tips

043 - Trimming options

Continuing topic about trimming the final binary 🗜. Lets discuss what options we do have for that. Trimming without configuring options would be useful only in very limited number of cases.

Some other options that can be used during the process:

Docs📑: https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options?pivots=dotnet-8-0

<PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsing>enable</ImplicitUsing>
    <Nullable>enable</Nullable>

    <!-- add this 👇 -->
    <PublishTrimmed>true</PublishTrimmed>
    <!-- and those as needed 👇>
    <TrimMode>partial</TrimMode>
    <TrimmerRemoveSymbols>true</TrimmerRemoveSymbols>
</PropertyGroup>