runtime: net7 - Build freezes when publishing trimmed app with net6+ class libraries
I have a sln which contains several class libraries and one executable cmdline csproj. I’m modernizing whole solution, removing mono/net461 executable, upgrading class libraries from netstandard20 to net7. When publishing my app with parameters:
dotnet publish my.csproj -r linux-arm -p:PublishTrimmed=True -p:TrimMode=partial --self-contained true -c Release -f net7.0
and one specific csproj of my class libraries is set to net7.0 build freezes. on line
C:\Program Files\dotnet\dotnet.exe exec "C:\Program Files\dotnet\sdk\7.0.101\Roslyn\bincore\csc.dll" ...
Freezing means than NET host process takes almost all cpu, a several Gigs of RAM.
To “unfreeze” build I have to:
- remove trimming (
-p:PublishTrimmed=True -p:TrimMode=partial) - without trimming build is completed in 20sec - set this one library to netstandard20 and build with net7 SDK
- set all csproj files in solution to net6 and build in net6 SDK - net6 build completes in about a minute without problems
Building it on Windows 10,11 and in linux docker.
What I’ve tried and didn’t help:
- build with MS net7 SDK docker
- build for different runtimes - linux-x64, win-x64, linux-arm…
- SDK 7.0.100 and 7.0.101
Unfortunately project is closed source. But I can run some test, access my desktop remotely or something like that.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 26 (8 by maintainers)
7.0.9 - still freezes
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>- to one of the libraries and it builds ok!for us, our Blazor WASM project builds in about 4 minutes with .NET 6 or without trimming, 1+ hour with .NET 7 and trimming