User Roslyn analyzers in all projects
The build system used to allow projects to opt out of anaylzers by setting the property `$(UseRoslynAnalyzers)` to false before importing Settings.props. This meant it occured at the top of the file above all other elements, including the main property group block. This doesn't really have an equivalent approach in the new SDK. There is no way to pass a property value from the project file to the Directory.Build.props file as it's implicitly imported. The correct approach in the new SDK would be to do the following: 1. Define `$(UseRoslynAnalyzers)` in main property group block 1. Use the Roslyn analyzers as a `<PackageReference>` declaration in the `Imports.targets` file and have it condition on `$(UseRoslynAnalyzers)` not being false. Doing that is a pretty siginificant rework of our build though. As a test I just disabled the analyzers everywhere and found we had a total of three warnings. Decided to just fix those as it was very straight forward to do.
Showing
想要评论请 注册 或 登录