Skip to content

Use upper-bound version ranges for sibling package dependencies#4337

Merged
paulmedynski merged 5 commits into
mainfrom
dev/paul/upper-bounds
Jun 10, 2026
Merged

Use upper-bound version ranges for sibling package dependencies#4337
paulmedynski merged 5 commits into
mainfrom
dev/paul/upper-bounds

Conversation

@paulmedynski

@paulmedynski paulmedynski commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Compute [floor, ceiling) ranges for sibling packages so NuGet cannot resolve an incompatible newer major version at restore time.

Changes

  • Directory.Packages.props: Derive *VersionCeiling from *PackageVersion using MSBuild property functions; apply [floor, ceiling) ranges to all sibling PackageVersion items; add centralized SniVersion / SniVersionRange properties.
  • SqlClient csproj: Compute version range properties for nuspec token expansion.
  • SqlClient nuspec: Replace bare version tokens with range tokens ($AbstractionsVersionRange$, $LoggingVersionRange$, $SqlServerVersionRange$, $SniVersionRange$).

How it works

The ceiling is the next major version (prerelease suffix stripped) derived from the floor:

Floor:   1.1.0-preview1-ci123
Ceiling: 2.0.0
Range:   [1.1.0-preview1-ci123, 2.0.0)

This is self-contained — no separate "next version" lookup is needed. The range prevents NuGet from pulling in a newer major version that could be binary-incompatible, while allowing minor/patch updates within the same major version per SemVer semantics.

This follows the same pattern used by EF Core for tightly-coupled sibling packages.

Pipeline Verification

  • PR runs:
  • CI runs:
  • OneBranch runs:
    • Non-Official: 26161.2
    • Official: Can't trigger until the changes merge to ADO.Net via a PR.

Reviewers should inspect the NuGet package artifacts produced by the above runs to confirm that the sibling dependencies specify the expected version ranges.

Manual Verification

  • dotnet build (direct, net8.0/net9.0) — Project mode ✓, Package mode ✓
  • build.proj -t:Build — Project mode ✓, Package mode ✓
  • build.proj -t:Pack — Project mode ✓, Package mode ✓
  • Produced .nupkg files contain correct [floor, ceiling) dependency ranges for all sibling packages and SNI

Compute [floor, ceiling) ranges for sibling packages so NuGet cannot
resolve an incompatible newer minor/major version at restore time.

- Directory.Packages.props: derive *VersionCeiling from *PackageVersion;
  apply ranges to sibling PackageVersion items; add SniVersionRange
- SqlClient csproj: compute version range properties for nuspec expansion
- SqlClient nuspec: replace bare version tokens with range tokens
Copilot AI review requested due to automatic review settings June 3, 2026 14:40
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Jun 3, 2026
@paulmedynski paulmedynski added the Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems. label Jun 3, 2026
@paulmedynski paulmedynski moved this from To triage to In progress in SqlClient Board Jun 3, 2026
@paulmedynski paulmedynski added this to the 7.1.0-preview2 milestone Jun 3, 2026

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.

Pull request overview

This PR changes how Microsoft.Data.SqlClient expresses dependency versions by computing [floor, ceiling) version ranges (ceiling = next minor) for sibling packages and SNI, and emitting those ranges into the produced .nuspec/.nupkg.

Changes:

  • Compute “next-minor” ceilings from existing *PackageVersion / SniVersion values and form [floor, ceiling) ranges.
  • Apply those ranges in Central Package Management (Directory.Packages.props) for sibling package dependencies (Package mode) and SNI.
  • Update the SqlClient pack flow to materialize dependency range tokens into the generated nuspec.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
Directory.Packages.props Adds MSBuild-derived ceiling/range properties and applies [floor, ceiling) ranges to sibling package PackageVersions and SNI.
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj Computes version ranges during nuspec materialization and substitutes new range tokens.
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.nuspec Replaces dependency version tokens with range tokens for sibling packages and SNI.

Comment thread src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.nuspec
Comment thread Directory.Packages.props
Comment thread src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj Outdated
@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.07%. Comparing base (5ac26c9) to head (4a812f3).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4337      +/-   ##
==========================================
- Coverage   66.50%   65.07%   -1.44%     
==========================================
  Files         285      285              
  Lines       43311    66448   +23137     
==========================================
+ Hits        28806    43240   +14434     
- Misses      14505    23208    +8703     
Flag Coverage Δ
CI-SqlClient 66.49% <ø> (-0.02%) ⬇️
PR-SqlClient-Project 64.69% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread Directory.Packages.props
The CI/PR pack jobs for Abstractions and Azure extensions were not
passing ReferenceType=Package to dotnet pack, causing the projects to
use ProjectReference mode for sibling dependencies. NuGet converts
ProjectReferences to bare version dependencies (no ranges), which
defeats the upper-bound version ranges defined in Directory.Packages.props.

Fix:
- pack-abstractions-package-ci-job: Add referenceType, loggingArtifactsName,
  and loggingPackageVersion parameters. When referenceType=Package, download
  Logging artifacts and pass ReferenceType + LoggingPackageVersion to dotnet
  pack buildProperties.
- pack-azure-package-ci-job: Add loggingPackageVersion parameter. When
  referenceType=Package, pass ReferenceType + dependency versions to dotnet
  pack buildProperties.
- Wire the new parameters through build-abstractions-package-ci-stage.yml
  and dotnet-sqlclient-ci-core.yml.
Comment thread eng/pipelines/jobs/pack-abstractions-package-ci-job.yml
@paulmedynski paulmedynski marked this pull request as ready for review June 4, 2026 14:02
@paulmedynski paulmedynski requested a review from a team as a code owner June 4, 2026 14:02
Copilot AI review requested due to automatic review settings June 4, 2026 14:02
@paulmedynski paulmedynski moved this from In progress to In review in SqlClient Board Jun 4, 2026
@paulmedynski paulmedynski enabled auto-merge (squash) June 4, 2026 14:04

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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comment thread src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj Outdated
Comment thread Directory.Packages.props Outdated
Comment thread Directory.Packages.props Outdated
Address Copilot review feedback: guard against whitespace in version
values passed via -p: arguments by trimming before splitting.

- Directory.Packages.props: Add .Trim() before .Split('.') on all
  *PackageVersion properties used in ceiling computation.
- Microsoft.Data.SqlClient.csproj: Use the already-computed
  _*PackageVersionTrimmed properties as inputs to the range strings
  instead of the raw *PackageVersion values.
Comment thread Directory.Packages.props Outdated
@github-project-automation github-project-automation Bot moved this from In review to Waiting for customer in SqlClient Board Jun 4, 2026
@mdaigle mdaigle moved this from Waiting for customer to In review in SqlClient Board Jun 5, 2026
Per review feedback on PR #4337 (cheenamalhotra + team consensus),
upper-bound ceilings for sibling package dependencies now use the next
major version instead of the next minor version.

Example: Abstractions 1.0.0 → range [1.0.0, 2.0.0) instead of [1.0.0, 1.1.0).

This aligns with SemVer semantics (minor releases must not break consumers)
and follows the same pattern used by EF Core for tightly-coupled siblings.
Copilot AI review requested due to automatic review settings June 8, 2026 16:04
@paulmedynski paulmedynski added Hotfix 7.0.2 PRs targeting main that should be backported to release/7.0 for the 7.0.2 release. Hotfix 6.1.6 PRs targeting main that should be backported to release/6.1 for the 6.1.6 release. labels Jun 8, 2026

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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread Directory.Packages.props
@mdaigle

mdaigle commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Looks good. Watching this build to verify the switch to major+1: https://dev.azure.com/SqlClientDrivers/ADO.Net/_build/results?buildId=155786&view=results

@paulmedynski

Copy link
Copy Markdown
Collaborator Author

That branch in ADO.Net was stale - new non-official run here with the latest changes: https://dev.azure.com/SqlClientDrivers/ADO.Net/_build/results?buildId=155858&view=results

@paulmedynski paulmedynski merged commit fd8cb4b into main Jun 10, 2026
680 checks passed
@paulmedynski paulmedynski deleted the dev/paul/upper-bounds branch June 10, 2026 19:05
@github-project-automation github-project-automation Bot moved this from In review to Done in SqlClient Board Jun 10, 2026
@cheenamalhotra cheenamalhotra removed the Hotfix 6.1.6 PRs targeting main that should be backported to release/6.1 for the 6.1.6 release. label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems. Hotfix 7.0.2 PRs targeting main that should be backported to release/7.0 for the 7.0.2 release.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants