Consolidate roslyn options to build with analyzers - #85227
Merged
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change consistently removes internal RoslynEnforceCodeStyle usage and correctly routes analyzer/code-style behavior through RunAnalyzersDuringBuild across scripts, targets, and CI.
Pull request overview
This PR consolidates Roslyn’s “build with analyzers” configuration so builds can be driven solely via RunAnalyzersDuringBuild (and existing --runanalyzers/-runAnalyzers switches), removing the need for the extra RoslynEnforceCodeStyle property.
Changes:
- Updates MSBuild defaults to keep analyzers off by default unless explicitly enabled, and keys code-style enforcement/suppressions off
RunAnalyzersDuringBuild. - Removes
RoslynEnforceCodeStyleusage from engineering scripts and CI, switching callers toRunAnalyzersDuringBuild/--runanalyzers.
File summaries
| File | Description |
|---|---|
| eng/validate-rules-missing-documentation.ps1 | Removes RoslynEnforceCodeStyle override; keeps analyzers explicitly disabled for this target run. |
| eng/validate-roslyn-sdk-samples.ps1 | Switches SDK samples validation to enable analyzers via /p:RunAnalyzersDuringBuild=true. |
| eng/test-build-correctness.ps1 | Drops RoslynEnforceCodeStyle property injection; relies on -runAnalyzers plumbing instead. |
| eng/targets/Settings.props | Removes the RoslynEnforceCodeStyle-based IDE0055 “not as error” logic from props. |
| eng/targets/Imports.targets | Centralizes defaults and IDE0055 suppression behavior based on RunAnalyzersDuringBuild, and ties RoslynCheckCodeStyle to analyzer-enabled CI builds. |
| eng/make-bootstrap.ps1 | Removes RoslynEnforceCodeStyle=false from bootstrap build args; continues to explicitly disable analyzers. |
| azure-pipelines.yml | Simplifies the “Build with analyzers” step by removing /p:RoslynEnforceCodeStyle=true (keeps --runanalyzers). |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 0
- Review effort level: Lite
akhera99
approved these changes
Sep 9, 2026
dibarbet
approved these changes
Sep 9, 2026
jasonmalinowski
approved these changes
Sep 9, 2026
jasonmalinowski
left a comment
Member
There was a problem hiding this comment.
Thanks for doing this!
This was referenced Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows passing just
/p:RunAnalyzersDuringBuild=trueto run a build with analyzers instead of/p:RoslynEnforceCodeStyle=true /p:RunAnalyzersDuringBuild=true.Microsoft Reviewers: Open in CodeFlow