Skip to content

Conversation

gewarren
Copy link
Contributor

@gewarren gewarren commented Oct 1, 2025

@gewarren gewarren enabled auto-merge (squash) October 1, 2025 15:35
For more information and other ways to suppress warnings, see [How to suppress code analysis warnings](suppress-warnings.md).
## Enable code analysis in legacy projects
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's legacy projects in this context?
I was thinking about this further down "If your project targets .NET Standard or .NET Framework," I was under the impression that if you use a .NET SDK 5+ your .NET Standard project would get analysis enabled by default but I might be mistaken about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here legacy refers to both non-SDK-style projects and SDK-style projects that target .NET Framework or .NET Standard.

Based on the info I was given, if your project targets .NET Standard, it's not enabled by default.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NuGet package reference and the (now newly documented) workaround are only needed for non SDK style projects.

SDK style projects that target .NET Framework or .NET Standard don't have analyzers enabled by default, but those can use EnableNETAnalyzers and AnalysisLevel as already documented.

So maybe the header (and text) should be changed to "non SDK style projects"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but those can use EnableNETAnalyzers and AnalysisLevel as already documented.

Well, that part (EnableNETAnalyzers) is documented in this section too, so changing the heading wouldn't be accurate unless we move that part somewhere else.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right, sorry. I should read more than the one line that is shown in the context of the comment 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document how to configure code analyzers in legacy projects
4 participants