I'm trying to bring code analysis to our projects, so I started with a solution with both .NET Framework and .NET Standard projects.
I followed this tutorial but to sum-up, here is what I did:
- Added a
SolutionName.rulesetfile at the solution level - Added a
stylecop.jsonfile at solution level and referenced this file as link in each project - Installed
StyleCop.Analyzers 1.1.0-beta009Nuget package on every project - Installed
Microsoft.NetCore.Analyzerson .NET Standard projects andMicrosoft.NetFramework.Analyzersfor .NET Framework projects
First of all, Visual Studio looks so buggy but it's maybe due to some black magic I don't understand.
If I click on the ruleset file in the solution explorer, I play a bit with ticking and de-ticking the several checkboxes of each rules group and re-build to see the changes in the Error List window but after a short time it doesn't work anymore. I'm even trying to deselect everything, build again and all my warnings are still here. The only way to make them disappear is to close Visual Studio.
As shown on the screenshot, I expended the .NET Standard library project called ConfigLibrary to see that it has several associated Analyzers.
The problem is that all these rules seem to come from the Nuget package's DLL C:\Users\user\.nuget\packages\stylecop.analyzers\1.1.0-beta009\analyzers\dotnet\cs\StyleCop.Analyzers.dll.
If I deselect the StyleCop.Analyzers rules in my ruleset file, it does nothing, and if I search for these rules codes using the search textbox, it shows they are not selected. But at the end these rules are still applied...
When I try to uninstall the StyleCop.Analyzers Nuget package for all projects, then I don't get at all these warnings even when the rules are selected in my ruleset file.
Also my ruleset file is often automatically re-written by I don't know what process. And the rules don't work anymore even after I restart Visual Studio
So what is the proper way to handle some code analysis rule at the solution level for both .NET Framework and .NET Core projects?
How to avoid the analyzers' DLLs to override my rules defined in my ruleset file? Is there a workaround to make Visual Studio properly refresh the applied rules? Build, Rebuild and Run code analysis on solution are all buggy, only restarting Visual Studio works but it's kind of a heavy workaround especially with all these rules...
Is it me not understanding a basis concept or am I facing some weird bugs with .NET Core? Thank you

