Skip to content

Consolidate roslyn options to build with analyzers - #85227

Merged
jjonescz merged 1 commit into
dotnet:mainfrom
jjonescz:build-with-analyzers
Sep 10, 2026
Merged

Consolidate roslyn options to build with analyzers#85227
jjonescz merged 1 commit into
dotnet:mainfrom
jjonescz:build-with-analyzers

Conversation

@jjonescz

@jjonescz jjonescz commented Sep 9, 2026

Copy link
Copy Markdown
Member

Allows passing just /p:RunAnalyzersDuringBuild=true to run a build with analyzers instead of /p:RoslynEnforceCodeStyle=true /p:RunAnalyzersDuringBuild=true.

Microsoft Reviewers: Open in CodeFlow

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@jjonescz
jjonescz marked this pull request as ready for review September 9, 2026 15:08
@jjonescz
jjonescz requested a review from a team as a code owner September 9, 2026 15:08
Copilot AI lite review requested due to automatic review settings September 9, 2026 15:08
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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 RoslynEnforceCodeStyle usage from engineering scripts and CI, switching callers to RunAnalyzersDuringBuild / --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

@jasonmalinowski jasonmalinowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for doing this!

@jjonescz
jjonescz merged commit 07d8d64 into dotnet:main Sep 10, 2026
28 checks passed
@jjonescz
jjonescz deleted the build-with-analyzers branch September 10, 2026 07:13
@dotnet-policy-service dotnet-policy-service Bot added this to the Next milestone Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants