Update:
This has been fixed in the 7.0.3xx version of the .Net SDK, which is now in preview and can be downloaded from dotnet/installer.
Original:
We have found a number of issues reported from the trimmer that shipped with the .Net 7 SDK. Most of these issues have been addressed in the latest builds but haven't made their way into servicing releases of the .Net 7 SDK. The following issues have been addressed and will be fixed in the .Net SDK version 7.0.3xx:
If you run into an issue related to the above issues, slow trimming, or high memory usage, please try using the latest version of the linker to see if that fixes your issue.
To use the latest version (as of December 12, 2022), add a PackageReference to your .csproj file.
<ItemGroup>
<PackageReference Include="Microsoft.Net.ILLink.Tasks" Version="8.0.100-1.22612.2" />
</ItemGroup>
Then, add a nuget.config file if you don't already have one by running dotnet new nugetconfig in the same directory as the .csproj. In the nuget.config add the dotnet8 package sources by adding the <add key=...> line below.
<configuration>
<packageSources>
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
</packageSources>
</configuration>
Update:
This has been fixed in the 7.0.3xx version of the .Net SDK, which is now in preview and can be downloaded from dotnet/installer.
Original:
We have found a number of issues reported from the trimmer that shipped with the .Net 7 SDK. Most of these issues have been addressed in the latest builds but haven't made their way into servicing releases of the .Net 7 SDK. The following issues have been addressed and will be fixed in the .Net SDK version 7.0.3xx:
If you run into an issue related to the above issues, slow trimming, or high memory usage, please try using the latest version of the linker to see if that fixes your issue.
To use the latest version (as of December 12, 2022), add a PackageReference to your .csproj file.
Then, add a nuget.config file if you don't already have one by running
dotnet new nugetconfigin the same directory as the .csproj. In the nuget.config add the dotnet8 package sources by adding the<add key=...>line below.