We worked before with FxCop Code Analyzers and TFS check in policies. I can find articles to migrate the code analysis to .Net Analyzer. I changed a project and the code analysis seems to be working after removing the deprecated FxCop.
But I cannot find any information regarding changing the check in policies to match with the new .NET Analyzers. Does anyone have information on this topic?
.csproj true
<AnalysisLevel>none</AnalysisLevel>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
Instead of a ruleset .NetAnalyzers seem to use "Analysis Level" which can not be configured in the checkin policies.
Build is working fine without errors and we get warnings due to code analysis. We tried to add a Code Ruleset in the project for the MinimumRecommendedRules.ruleset but when we check in get:
An unexpected error occurred while evaluating the Code Analysis check-in policy. The error might be transient. Try again.
Apparently, it is not possible to use both features together.
The Check-In-Policy checks (among other things) whether the
<RunCodeAnalysis>
-msbuild setting is set to true.Anyways, this setting forces the legacy binary analysis to run.
Reference (from Microsoft Docs):
I think it should not be needed to have a seperate check-in policys anymore, as the .NET analyzers run on every (release, depending on your configuration) build.