-
Notifications
You must be signed in to change notification settings - Fork 6k
Add info for configuring code analysis in legacy projects #48804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😄
Fixes #45182.
cc @cremor
Internal previews