Files
AI-Studio/app/Trimming.props
T

38 lines
2.4 KiB
XML
Raw Normal View History

<Project>
<!--
How a published build of AI Studio is trimmed. Kept apart from the project of the app, so that every
project which has to trim exactly like the app imports the same settings, instead of a copy which drifts.
-->
<PropertyGroup>
<PublishTrimmed>true</PublishTrimmed> <!-- Publish with trimming, to reduce size -->
<TrimMode>partial</TrimMode> <!-- Trim only assemblies marked as trimmable: all of .NET, but neither our own nor most packages -->
<TrimmerRemoveSymbols>true</TrimmerRemoveSymbols> <!-- Remove debug symbols -->
<EnableUnsafeBinaryFormatterSerialization>false</EnableUnsafeBinaryFormatterSerialization> <!-- Remove unsafe binary formatter serialization -->
<EnableUnsafeUTF7Encoding>false</EnableUnsafeUTF7Encoding> <!-- Remove unsafe UTF7 encoding -->
<JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault> <!-- Enable reflection for JSON serialization -->
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings> <!-- Suppress trim analysis warnings -->
</PropertyGroup>
<!--
System.Text.Json builds an immutable collection, e.g., the ImmutableHashSet of a chat, through a factory method
like ImmutableHashSet.CreateRange, which it finds by reflection at runtime. Nothing calls that method directly,
so the trimmer removes it, and every type which holds such a collection fails to load and to save. Only a
published build shows this: debug builds and the tests are not trimmed. Hence, we keep the whole assembly.
-->
<ItemGroup>
<TrimmerRootAssembly Include="System.Collections.Immutable" />
</ItemGroup>
2026-11-01 20:32:16 +01:00
<!--
Since .NET 10, Blazor carries some state of its own from the page into the circuit as JSON, the antiforgery
token among it. It reads that state by reflection, too, and the trimmer removes the properties of the token,
since nothing else reads them. The circuit then closes right after it started, and the window stays empty.
Microsoft keeps these properties for Blazor WebAssembly only (dotnet/aspnetcore#64819), since it does not
support trimming a Blazor Server app. Hence, we keep the whole assembly which holds the token.
-->
<ItemGroup>
<TrimmerRootAssembly Include="Microsoft.AspNetCore.Components.Web" />
</ItemGroup>
</Project>