Open
Description
Currently trimming and the ILLink task are designed to run on applications - and that is very easy (one or two MSBuild properties).
In .NET 5 we're introducing analysis in the linker where it can report potential issues in the app after trimming - can be enabled by setting SuppressTrimAnalysisWarnings=false
.
Being able to run this analysis on just libraries would be really beneficial as library author could use it to make the libraries trim-ready. The general idea is to have some MSBuild way (properties and/or items) to:
- Run ILLink just for analysis purposes - this could be completely without any output, just produce warnings
- Configure which warnings to see (warning level, disable warnings, warnings as errors, ...)
- Be able to focus on the library alone - so somehow disable warnings from references
- Run ILLink on a library project (classlib) - this would mean root all public APIs in the assembly and run analysis from there
- Run ILLink on a library project with produced output - not necessarily for shipping (although one day maybe even that), but to inspect the output for diagnostic reasons (for example find dead code in the library)
- Going forward be able to control which types of analysis to run (trim-ready, single-file-ready, AOT-ready, ...)
Filed in SDK as this is mostly SDK experience feature, but I do expect work for this to also happen in the mono/linker repo and potentially also in the dotnet/runtime repo if necessary.