Project-system: Enable code analysis

Created on 17 Dec 2016  路  8Comments  路  Source: dotnet/project-system

In build 15.0.26014.0:

  • _Analyze > Run Code Analysis > On Solution_

    • does nothing

  • _Analyze > Configure Code Analysis > For Solution_

    • shows "There are currently no analyzable projects loaded."

Bug Triage-No-Action

Most helpful comment

Really milestone 16.0? We need FxCop mainly for CA2000 which still has no replacement (I'm aware of). See https://github.com/dotnet/roslyn-analyzers/issues/476.

All 8 comments

Thanks - by Code Analysis here, you're looking to use FxCop and not C#/VB's automatic analysis?

Yes, FxCop on a library targeting net20 and netstandard1.3.

Really milestone 16.0? We need FxCop mainly for CA2000 which still has no replacement (I'm aware of). See https://github.com/dotnet/roslyn-analyzers/issues/476.

If you are using custom rules, and custom analyzers as Visual Studio extensions, you need to edit the csproj file and add

<CodeAnalysisRuleSet>..\MyCompanyCodeAnalysisRules.ruleset</CodeAnalysisRuleSet>

in the PropertyGroup

to match the behavior of the .net Framework projects. (from https://stackoverflow.com/a/44726528/444469)

Would be nice to be able to edit this property in the project properties, as the analyzers will default to their own configuration without the correct value.

Let's review this together in the next triage session.

Running _Analyze > Run Code Analysis > On Solution_ shows that analysis is running in the status bar, but no results are produced. This occurs in both project systems, so I cannot see what action is needed here. I may misunderstand the feature though.

Running _Analyze > Configure Code Analysis > For Solution_ shows:

image

NOTE: This property page has been deprecated and will be removed in a future product release. Learn more at https://docs.microsoft.com/visualstudio/code-quality/analyzers-faq#code-analysis-solution-property-page

@drewnoakes That command now runs installed analyzers. Can you try to install an analyzer package to the project and retry?

I think we can close this; the FxCop and other source-based analyzers have replaced binary analysis that this used to perform, see: https://docs.microsoft.com/en-us/visualstudio/code-quality/migrate-from-legacy-analysis-to-fxcop-analyzers?view=vs-2019.

Yes, the FxCopAnalyzers package has totally replaced my need for this.

Was this page helpful?
0 / 5 - 0 ratings