C
C#6mo ago
Remaetanju

AOT Compilation trimming

hi, i have a nuget package that i use in my code (a client api to download from mega) when i AOT compile my code, it runs but there is an exception It catches that tell me the package doesnt work (simple login anon that should not fail) I think the trimmer remove too much code from the nuget package, causing it to breaks is there an option to exclude this nuget package from being trimmed ? so i could test it im on .net 8.0
6 Replies
cap5lut
cap5lut6mo ago
https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options?pivots=dotnet-8-0#trimming-granularity seems u can set the mode to partial but then u will have to list all packages u want to trim
Remaetanju
Remaetanju5mo ago
Ill give it a try today and come back to u Hi, i tried to use mode partial but seems that the library code is still trimmed. like publishAOT doesnt refer to trimMode and relative settings
Remaetanju
Remaetanju5mo ago
Here the complete output I found properties to use and apparently disable trimming on some libraries (exe size going up) (build success but exe crashes later than before without the newly founds properties)
Remaetanju
Remaetanju5mo ago
and the properties i use
Remaetanju
Remaetanju5mo ago
<EnableTrimAnalyzer>true</EnableTrimAnalyzer> seems to be iimportant to always have warnings about trimm in the console <IsTrimmable>true</IsTrimmable> seems important otherwise trimmable assembly doesnt work ?