Skip to content

Pin ASP.NET Core compiler-hosted Roslyn dependencies explicitly - #10336

Merged
akoeplinger merged 2 commits into
mainfrom
cleanup-aspnetcore-roslyn-pins
Oct 22, 2026
Merged

akoeplinger merged 2 commits into
mainfrom
cleanup-aspnetcore-roslyn-pins

Conversation

@akoeplinger

@akoeplinger akoeplinger commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #10335 and the review discussion.

Pin Roslyn dependencies explicitly for compiler-hosted components rather than forcing every MicrosoftCodeAnalysisVersion_LatestVS consumer onto N-1 packages:

  • Replace the shared generator version with package-specific SourceGenerator_…Version properties and use them across RequestDelegateGenerator, Validation, OpenAPI, the framework generators, Components AI/Testing/NativeAot, and SignalR.
  • Give newer framework analyzers and code fixes dedicated Analyzer_…Version_LatestVS properties, preserving their normal-build versions separately from the legacy analyzers.
  • Map each compiler-host property to its corresponding N-1 package version during source-build.
  • Restore the general MicrosoftCodeAnalysisVersion_LatestVS override to current source-built Roslyn, reversing the broad version override introduced by Keep source-built ASP.NET Core analyzers bootstrap-compatible #10335 only after isolating its compiler-hosted consumers.

Normal-build resolved Roslyn versions remain unchanged. Preserve the detailed bootstrap compatibility comment and explain the separate analyzer compatibility policies.

Validation

  • Release builds of all ten affected compiler-hosted projects passed with zero warnings and errors (dotnet build <project> -c Release -p:UseIisNativeAssets=false, using the repository SDK).
  • MSBuild evaluation of all fourteen compiler-hosted projects verified unchanged normal-build versions and explicit package-specific N-1 references with live central versions. A benchmark-project control verified that general LatestVS consumers remain live. Source-build evaluation used a synthetic package-version props file derived from the VMR override items.
  • A temporary initialization harness passed on the SDK 11 runtime: 34 analyzer, source-generator, and code-fix types exercised across the ten assemblies, with no analyzer or generator exceptions.
  • The framework analyzer test suite was blocked during restore by unavailable Microsoft.NETCore.App.Ref/12.0.0-dev. Full source-build validation was not run.

Note

This pull request was prepared with GitHub Copilot.

…ators

Replace the shared source-generator version with Common and CSharp properties following the existing Analyzer_ convention. Use them in RequestDelegateGenerator, Validation, and OpenAPI, and map each to its corresponding previous-package version in source-build.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: aab39968-c93b-478a-acee-e9f7b2eefc26
Copilot AI balanced review requested due to automatic review settings October 20, 2026 17:43
@akoeplinger
akoeplinger requested review from a team as code owners October 20, 2026 17:43
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team October 20, 2026 17:43
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
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 property definitions, generator references, and source-build mappings are consistent, with no unresolved findings.

No open issues 🎉

What changed in this PR

Standardizes ASP.NET Core generator Roslyn versions while preserving bootstrap compatibility established by #10335.

Changes:

  • Uses separate Common and CSharp version properties across all three generators.
  • Maps source-build overrides to corresponding N-1 packages, preserving normal-build defaults.
  • Clarifies why older-VS-compatible analyzers use separate properties.
File Description
src/​aspnetcore/​src/​Validation/​gen/​Microsoft.Extensions.Validation.ValidationsGenerator.csproj Uses package-specific generator versions.
src/​aspnetcore/​src/​OpenApi/​gen/​Microsoft.AspNetCore.OpenApi.SourceGenerators.csproj Uses package-specific generator versions.
src/​aspnetcore/​src/​Http/​Http.Extensions/​gen/​Microsoft.AspNetCore.Http.RequestDelegateGenerator/​Microsoft.AspNetCore.Http.RequestDelegateGenerator.csproj Replaces the shared generator version property.
src/​aspnetcore/​eng/​Versions.props Defines separate Common and CSharp defaults.
repo-projects/​aspnetcore.proj Maps N-1 overrides and clarifies analyzer compatibility.

Review effort: Balanced

Give newer framework analyzers and code fixes dedicated latest-VS defaults and N-1 source-build overrides. Apply generator pins to the remaining framework, Components, and SignalR generators. Restore live Roslyn version flow for general LatestVS consumers without changing normal-build package versions.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: aab39968-c93b-478a-acee-e9f7b2eefc26
@akoeplinger akoeplinger changed the title Use package-specific Roslyn version properties for ASP.NET Core generators Pin ASP.NET Core compiler-hosted Roslyn dependencies explicitly Oct 20, 2026
@akoeplinger
akoeplinger merged commit e9431fa into main Oct 22, 2026
11 checks passed
@akoeplinger
akoeplinger deleted the cleanup-aspnetcore-roslyn-pins branch October 22, 2026 18:11
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.

3 participants