Improve warning message for ILLink runtime pack#33041
Conversation
| </data> | ||
| <data name="ILLinkNoValidRuntimePackageError" xml:space="preserve"> | ||
| <value>NETSDK1195: Unable to optimize assemblies for size: a valid runtime package was not found. Either set the PublishTrimmed property to false, or use a supported target framework when publishing.</value> | ||
| <value>NETSDK1195: Trimming, or code compatibility analysis for trimming, single-file deployment, or ahead-of-time compilation is not supported for the target framework.</value> |
There was a problem hiding this comment.
Definitely much better than before. But it's not actionable - it doesn't tell me what to do to "fix" this. Can we at least link to some doc (maybe just the trimming doc for now).
There was a problem hiding this comment.
The action item is really to do one of the following:
- Target a supported TFM
- Unset IsTrimmable
- Unset PublishTrimmed
- Unset IsAotCompatible
- Unset PublishAot
- Unset PublishSingleFile
- Unset EnableTrimAnalyzer
- Unset EnableAotAnalyzer
- Unset EnableSingleFileAnalyzer
The trimming doc probably shouldn't explain all of those. Maybe we can link to https://learn.microsoft.com/en-us/dotnet/core/deploying/ and add sections to that which mention trimming and AOT deployment? I think that'd be good enough even if it doesn't explicitly list properties like Enable*Analyzer.
Another option is to produce separate errors depending on which of those properties was set. I think this would be the best option if we want to really commit to actionable errors. Let me know what you think!
There was a problem hiding this comment.
I'm adding a dedicated doc page for NETSDK1195 in dotnet/docs#35655 and linking to it here.
This reverts commit 29cd2bd.
The ILLink "runtime pack" is required for any of the ILLink analyzers (trimming, single-file, aot compatibility), as well as for trimming. This message is also only produced when those settings are enabled for an unsupported target framework. Hopefully this makes the error more clear.
Together with #32045, this should address dotnet/linker#3175 by providing an understandable error when someone tries to use the analyzer for netstandard library projects.