diff --git a/.github/instructions/package-versions.instructions.md b/.github/instructions/3rd-party-package-versions.instructions.md similarity index 96% rename from .github/instructions/package-versions.instructions.md rename to .github/instructions/3rd-party-package-versions.instructions.md index 9dba7acb8e..1de7df26bf 100644 --- a/.github/instructions/package-versions.instructions.md +++ b/.github/instructions/3rd-party-package-versions.instructions.md @@ -1,9 +1,11 @@ --- applyTo: "**/Directory.Packages.props,**/*.csproj,**/Directory.Build.props,**/*.nuspec" --- -# Choosing Package Versions in Multi-Targeted Projects +# Choosing Third-Party Package Dependency Versions -Guidance for choosing NuGet package versions in multi-targeted projects (e.g. `net462;net8.0;net9.0`). +Guidance for choosing versions of **external (third-party) NuGet package dependencies** in multi-targeted projects (e.g. `net462;net8.0;net9.0`). + +> **Scope:** This document covers dependencies consumed from NuGet — packages the SqlClient repo does NOT own. For versioning of SqlClient's own inter-sibling packages (Logging, Abstractions, SqlClient, Azure, AKV Provider, SqlServer.Server), see `sqlclient-package-versions.instructions.md`. ## Rule For runtime-aligned packages, **the package major must match the target runtime major**: 8.x on `net8.0`, 9.x on `net9.0`, 10.x on `net10.0`, and so on. TFMs that aren't tied to a specific runtime major (`net462`, `netstandard2.0`) get the major of the floor LTS. Other categories are versioned as described below. diff --git a/.github/instructions/onebranch-pipeline-design.instructions.md b/.github/instructions/onebranch-pipeline-design.instructions.md index 2421674eef..c429ff4a29 100644 --- a/.github/instructions/onebranch-pipeline-design.instructions.md +++ b/.github/instructions/onebranch-pipeline-design.instructions.md @@ -39,11 +39,9 @@ Defined in `stages/build-stages.yml`. Four build stages plus validation, ordered Each build job copies PDB files into `$(JOB_OUTPUT)/symbols/` so they are included in the auto-published pipeline artifact alongside the NuGet packages in `$(JOB_OUTPUT)/packages/`. Stage conditional rules: -- Wrap stages/jobs in `${{ if }}` compile-time conditionals based on build parameters -- `buildSqlClient` controls Stages 2, 3, validation, and Logging (when AKV is disabled) -- `buildAKVProvider AND buildSqlClient` controls Stage 4 -- `buildSqlServerServer` controls SqlServer.Server job in Stage 1 -- Logging builds when `buildAKVProvider OR buildSqlClient` is true +- The SqlClient family (Logging, Abstractions, SqlClient, Azure, AKV Provider) is **always built** — Stages 2, 3, and 4 and the Logging job in Stage 1 are unconditional. There is no `buildSqlClient`/`buildAKVProvider` toggle. +- `buildSqlServer` is the only build toggle; it controls just the SqlServer.Server job in Stage 1. +- When `buildSqlServer` is true, SqlClient/AKV depend on the freshly-built SqlServer artifact (downloaded into the local feed). When false, they depend on the most recently published SqlServer package — a version-only dependency (no artifact download) restored from NuGet. ## Job Templates @@ -62,7 +60,8 @@ When adding a new package to the OneBranch flow: - Defined in `stages/publish-symbols-stage.yml`; produces stage `publish_symbols` - Entire stage excluded at compile time when `publishSymbols` is false -- `dependsOn` is conditional based on which `build*` parameters are set, mirroring the build stage dependency graph +- The SqlClient family symbols are always published; the SqlServer.Server symbols job is conditional on `buildSqlServer` +- `dependsOn` covers all family build stages (always present), plus `build_independent` for SqlServer - One job per package (`publish-symbols-job.yml`), each downloading its build artifact and publishing PDBs from `symbols/` - Each package's PDBs are published separately with unique artifact names and version information - Build jobs copy PDBs into `$(JOB_OUTPUT)/symbols/` so they are included in the auto-published artifact @@ -88,16 +87,15 @@ When adding a new package to the OneBranch flow: ## Parameters -Build parameters (all boolean, default `true`): +Build parameters: - `debug` — enable debug output (default `false`) - `isPreview` — use preview version numbers (default `false`) - `publishSymbols` — publish symbols to servers (default `false`) -- `buildSqlServerServer` — build SqlServer.Server package -- `buildSqlClient` — build SqlClient, Extensions.Azure, Abstractions, and Logging -- `buildAKVProvider` — build AKV Provider (requires `buildSqlClient`) +- `buildSqlServer` — build the Microsoft.SqlServer.Server package (default `true`). The SqlClient family is always built, so this is the only build toggle. It also drives the SqlServer dependency version the family uses (built/next vs published). -Release parameters (all boolean, default `false`): -- `releaseSqlServerServer`, `releaseLogging`, `releaseAbstractions`, `releaseSqlClient`, `releaseAzure`, `releaseAKVProvider` +Release parameters (boolean, default `false`): +- `releaseSqlClient` — release the entire SqlClient family together (Logging, Abstractions, SqlClient, Azure, AKV Provider) at the shared version +- `releaseSqlServer` — release Microsoft.SqlServer.Server (versioned separately) Official-only parameter: - `releaseToProduction` — controls both NuGet target feed and symbol server destination (default `false`): diff --git a/.github/instructions/sqlclient-package-versions.instructions.md b/.github/instructions/sqlclient-package-versions.instructions.md new file mode 100644 index 0000000000..fc026dfa32 --- /dev/null +++ b/.github/instructions/sqlclient-package-versions.instructions.md @@ -0,0 +1,154 @@ +--- +applyTo: "**/Versions.props,build.proj,eng/pipelines/**/*.yml" +--- +# SqlClient Package Version Resolution + +How package versions are determined across different build scenarios for the packages in this repository. + +## Package families + +The repository ships two independently-versioned units: + +- **The SqlClient family** — `Microsoft.Data.SqlClient` plus the packages that version in lockstep with + it: `Microsoft.Data.SqlClient.Internal.Logging`, `Microsoft.Data.SqlClient.Extensions.Abstractions`, + `Microsoft.Data.SqlClient.Extensions.Azure`, and + `Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider`. **All family packages use the + SqlClient version numbers** — the same NuGet package version, file version, and assembly version — + and are always built and released together. +- **`Microsoft.SqlServer.Server`** — versioned and released on its own cadence. + +## Version Properties + +The SqlClient family version lives in `src/Microsoft.Data.SqlClient/Versions.props`, which is imported +for every project by `src/Directory.Build.props` (so the `SqlClient*` version properties are always +available). `Microsoft.SqlServer.Server` declares its own version in its own `Versions.props`. + +| Property | Applies to | Purpose | Example | +|----------|-----------|---------|---------| +| `SqlClientNextVersion` | SqlClient family | Version being developed; used for the next release | `7.1.0-preview1` | +| `SqlServerNextVersion` | SqlServer | Version being developed for SqlServer | `1.1.0-preview1` | +| `SqlServerPublishedVersion` | SqlServer | Last SqlServer version shipped to NuGet | `1.0.0` | + +The SqlClient family always ships its next version, so there is **no** family `PublishedVersion`. Only +`Microsoft.SqlServer.Server` keeps a published version (used when it is built as a SqlClient dependency +but not itself released). + +## Resolution Logic + +Each `Versions.props` uses a 3-tier `` block: + +| Priority | Condition | PackageVersion | FileVersion | +|----------|-----------|----------------|-------------| +| 1 | `PackageVersion` explicitly provided | Used as-is | Strip prerelease + append BuildNumber | +| 2 | `BuildNumber` provided (non-zero) | `NextVersion[-BuildSuffix+BuildNumber]` | `NextVersion.Split('-')[0].BuildNumber` | +| 3 | Nothing provided | `NextVersion-dev` | `NextVersion.Split('-')[0].0` | + +For every family package, `` is `SqlClient` (e.g. `-p:SqlClientPackageVersion=...`); for +Microsoft.SqlServer.Server it is `SqlServer`. + +## Scenarios + +### Developer (local `dotnet build`) + +**Mode:** Project (default `ReferenceType=Project`) + +- No `BuildNumber`, no `BuildSuffix`, no `PackageVersion*` passed. +- Falls into Priority 3 (the `` branch). +- **Result:** `7.1.0-preview1-dev` / FileVersion `7.1.0.0` +- Dependencies are project references — no package versions needed for siblings. + +**Mode:** Package (`-p:ReferenceType=Package`) + +- Same version resolution for the package being built. +- Sibling dependencies are restored from local `packages/` feed (previously packed with `-dev` suffix). +- A developer would first `dotnet build build.proj -t:Pack` to produce local packages, then consume them. + +### PR Pipeline (non-official CI) + +**`buildSuffix`** set via core template parameter: +- `buildSuffix: 'pr'` (passed explicitly from PR pipeline) +- `BuildNumber` = `$(DayOfYear)$(Rev:rr)` (e.g. `15401` for day-of-year 154, run 01) + +**Mode:** Project (typical PR validation) + +- Versions computed in `compute-versions-ci-stage.yml` (runs `GetVersions*` targets with `-p:BuildSuffix=pr -p:BuildNumber=...`) +- Falls into Priority 2 with BuildSuffix present. +- **Result:** `7.1.0-preview1-pr15401` / FileVersion `7.1.0.15401` +- Dependencies are project references — all packages built together in-tree. + +**Mode:** Package (PR package-ref validation) + +- Same version computation via compute-versions stage. +- Downstream stages define stage-level variables from compute-versions output using `$[ stageDependencies... ]`. +- Each build step receives an explicit family `-p:SqlClientPackageVersion=` (and `-p:SqlServerPackageVersion=` where needed), hitting Priority 1. +- Sibling dependencies consumed from pipeline artifacts published by upstream stages. + +### CI Pipeline (non-official, triggered on merge) + +Same structure as PR but passes `buildSuffix: 'ci'` explicitly. + +- **Result:** `7.1.0-preview1-ci15401` / FileVersion `7.1.0.15401` + +### OneBranch Pipeline (official) + +**Mode:** Always Package (`ReferenceType=Package`) + +Uses the full `compute-versions-stage.yml` machinery: + +#### Step A: Compute Versions (dedicated early stage) + +1. Runs the `GetVersionsSqlClient` and `GetVersionsSqlServer` MSBuild targets against `build.proj`. +2. Each target calls `dotnet build -getProperty:PackageVersion` with `BuildNumber` but **no BuildSuffix**. +3. Falls into Priority 2 without BuildSuffix → `PackageVersion = NextVersion` as-is (e.g. `7.1.0-preview1`). +4. `GetVersionsSqlServer` also extracts `SqlServerPublishedVersion` (the SqlClient family has no published version). + +#### Step B: Resolve Effective Versions + +- The **SqlClient family** always uses `SqlClientNextVersion`. +- **`Microsoft.SqlServer.Server`** uses its next or published version based on the + `releaseSqlServer` boolean: + +| `releaseSqlServer` | Effective SqlServer Version | Meaning | +|--------------------------|-----------------------------|---------| +| `True` | `SqlServerNextVersion` (e.g. `1.1.0-preview1`) | SqlServer is being released | +| `False` | `SqlServerPublishedVersion` (e.g. `1.0.0`) | Only built as a SqlClient dependency; use last-shipped | + +These are published as ADO output variables: `versions.SqlClientPackageVersion`, +`versions.SqlServerPackageVersion`, and their `*FileVersion` counterparts. + +#### Step C: Build Stages Consume Pre-computed Versions + +Each downstream build job receives: +- `packageVersion` parameter → passed as `-p:SqlClientPackageVersion=` (or `-p:SqlServerPackageVersion=` for SqlServer) +- Dependency versions → family dependencies use the shared `SqlClientPackageVersion`; the SqlServer dependency uses `SqlServerPackageVersion` + +Since an explicit `PackageVersion` is provided, Versions.props hits Priority 1 — uses the value verbatim. + +#### Summary + +| Package | Version Source | Example | +|---------|----------------|---------| +| SqlClient family (always released together) | `SqlClientNextVersion` | `7.1.0-preview1` | +| SqlServer, being released | `SqlServerNextVersion` | `1.1.0-preview1` | +| SqlServer, dependency only | `SqlServerPublishedVersion` | `1.0.0` | + +## Key Architectural Difference + +| Scenario | Who computes versions | How dependencies get versions | +|----------|----------------------|-------------------------------| +| Developer | Versions.props inline (Priority 3) | Project references (no version needed) | +| PR/CI (Project) | `compute-versions-ci-stage` up-front | Project references (no version needed) | +| PR/CI (Package) | `compute-versions-ci-stage` up-front | Stage variables via `$[ stageDependencies... ]` → `-p:SqlClientPackageVersion=` / `-p:SqlServerPackageVersion=` | +| OneBranch | `compute-versions-stage` up-front | Explicit `-p:SqlClientPackageVersion=` / `-p:SqlServerPackageVersion=` from stage outputs | + +## Updating Versions + +After releasing the **SqlClient family**: +1. Update `SqlClientNextVersion` in `src/Microsoft.Data.SqlClient/Versions.props` to the next planned + version. (There is no family published version to update.) + +After releasing **`Microsoft.SqlServer.Server`**: +1. Update `SqlServerPublishedVersion` to the version just shipped. +2. Update `SqlServerNextVersion` to the next planned version. + +The SqlServer properties live in `src/Microsoft.SqlServer.Server/Versions.props`. diff --git a/BUILDGUIDE.md b/BUILDGUIDE.md index 073f6afc68..467efdae69 100644 --- a/BUILDGUIDE.md +++ b/BUILDGUIDE.md @@ -93,7 +93,8 @@ A selection of parameters for build targets in `build.proj` can be found below: | `[optional_parameter]` | Allowed Values | Default | Description | |-----------------------------------|----------------------------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------| | `-p:Configuration=` | `Debug`, `Release` | `Debug` | Build configuration | -| `-p:PackageVersion=` | `major.minor.patch[-prerelease]` | `[blank]` | Version to assign to the target package, where `` can be one of: `['Abstractions', 'Azure', 'AkvProvider', 'Logging', 'SqlClient', 'SqlServer']`. Assembly and file versions are derived from this, if it is provided. See Versioning for more details | +| `-p:PackageVersionSqlClient=` | `major.minor.patch[-prerelease]` | `[blank]` | Version to assign to the SqlClient family (`Microsoft.Data.SqlClient`, `Internal.Logging`, `Extensions.Abstractions`, `Extensions.Azure`, and the AKV Provider all share it). Assembly and file versions are derived from this, if it is provided. See Versioning for more details | +| `-p:PackageVersionSqlServer=` | `major.minor.patch[-prerelease]` | `[blank]` | Version to assign to `Microsoft.SqlServer.Server`, which is versioned separately from the SqlClient family. | @@ -119,10 +120,11 @@ Build Microsoft.Data.SqlClient in Release configuration: dotnet build -t:BuildSqlClient -p:Configuration=Release ``` -Build v1.2.3 of Microsoft.Data.SqlClient.Extensions.Abstractions: +Build a specific version of Microsoft.Data.SqlClient.Extensions.Abstractions (Abstractions is part of the +SqlClient family, so its version is set via the family parameter `PackageVersionSqlClient`): ```bash -dotnet build -t:BuildAbstractions -p:PackageVersionAbstractions=1.2.3 +dotnet build -t:BuildAbstractions -p:PackageVersionSqlClient=7.1.0 ``` ### Testing Projects @@ -227,16 +229,14 @@ A selection of parameters for pack targets in `build.proj` relevant to common de |------------------------------------|---------------|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| | `-p:Configuration=` | `Debug` | `Debug`, `Release` | Build configuration. Only applies if project and dependencies are being built. | | `-p:PackBuild=` | `true` | `true`, `false` | Whether or not to build the project before packing. If `false`, project must be built using the same parameters. | -| `-p:PackageVersion=` | `[blank]` | eg. `1.2.3-dev123` | Version to assign to the package, where `` can be one of: `['Abstractions', 'Azure', 'AkvProvider', 'Logging', 'SqlClient', 'SqlServer']`. If `PackBuild` is `true`, the assembly and file versions will be derived from this version. See Versioning for more details. | +| `-p:PackageVersionSqlClient=` | `[blank]` | eg. `7.1.0-dev123` | Version to assign to the entire SqlClient family (`Microsoft.Data.SqlClient`, `Internal.Logging`, `Extensions.Abstractions`, `Extensions.Azure`, and the AKV Provider — they all share the SqlClient version). If `PackBuild` is `true`, the assembly and file versions are derived from this version. See Versioning for more details. | +| `-p:PackageVersionSqlServer=` | `[blank]` | eg. `1.1.0-dev123` | Version to assign to `Microsoft.SqlServer.Server`, which is versioned separately from the SqlClient family. | -For `PackSqlClient`, these additional parameters are optional overrides for dependency versions injected into the SqlClient nuspec during pack: +For `PackSqlClient`, the SqlClient nuspec pins its family dependencies (Abstractions and Logging) to the same `SqlClientPackageVersion` value, so a single `-p:PackageVersionSqlClient=` controls both the SqlClient package version and those dependency ranges. `Microsoft.SqlServer.Server` is pinned separately via `-p:PackageVersionSqlServer=`. -- `-p:PackageVersionAbstractions=` -- `-p:PackageVersionLogging=` - -If omitted, `PackSqlClient` computes `AbstractionsPackageVersion` and `LoggingPackageVersion` from sibling projects using the current `BuildNumber` and `BuildSuffix` context. +If omitted, `PackSqlClient` computes these versions from `Versions.props` using the current `BuildNumber` and `BuildSuffix` context. #### Examples @@ -252,10 +252,11 @@ Package Microsoft.Data.SqlClient: dotnet build -t:PackSqlClient ``` -Package version 1.2.3 of Microsoft.Data.SqlClient.Extensions.Abstractions: +Package a specific version of Microsoft.Data.SqlClient.Extensions.Abstractions (set via the family parameter +`PackageVersionSqlClient`): ```bash -dotnet build -t:PackAbstractions -p:PackageVersionAbstractions=1.2.3 +dotnet build -t:PackAbstractions -p:PackageVersionSqlClient=7.1.0 ``` Package Microsoft.Data.SqlClient.Extensions.Azure without building it beforehand: @@ -267,17 +268,19 @@ dotnet build -t:PackAzure -p:PackBuild=false ## Versioning Versioning can be accomplished by using a mix of different parameters to the `build.proj` targets: -`PackageVersion`, `BuildNumber`, and `BuildSuffix`. Using these in different combinations, can generate -appropriate package, assembly, and file versions for different scenarios. For most developer workflows, it is not -necessary to specify any of these parameters - appropriate versions based on the latest release will be generated -automatically. This section primarily exists to document the various parameters, their effects, and the scenarios they -can be useful for. +`PackageVersionSqlClient` (or `PackageVersionSqlServer`), `BuildNumber`, and `BuildSuffix`. Using these in different +combinations can generate appropriate package, assembly, and file versions for different scenarios. For most developer +workflows, it is not necessary to specify any of these parameters - appropriate versions based on the latest release +will be generated automatically. This section primarily exists to document the various parameters, their effects, and +the scenarios they can be useful for. -`PackageVersion` applies to whatever package is being built. For example, if you are building the -Microsoft.Data.SqlClient package, the appropriate parameter is `-p:PackageVersionSqlClient`. +All packages in the **SqlClient family** (`Microsoft.Data.SqlClient`, `Internal.Logging`, `Extensions.Abstractions`, +`Extensions.Azure`, and the AKV Provider) share a single version, set via `-p:PackageVersionSqlClient`. +`Microsoft.SqlServer.Server` is versioned separately via `-p:PackageVersionSqlServer`. -Each package has a `Versions.props` file in its root directory that defines a "default" version. This should be defined -as the latest released version of the package. For the table below, we assume this is "1.2.3". +The SqlClient family version is defined in `src/Microsoft.Data.SqlClient/Versions.props` (and SqlServer's in its own +`Versions.props`), which declares a "default" version — the next version to release. For the table below, we assume this +is "1.2.3". | `PackageVersion` | `BuildNumber` | `BuildSuffix` | Package Version | Assembly Version | File Version | Scenario | |------------------|---------------|---------------|------------------|------------------|---------------|------------------------------------------------------------| @@ -297,18 +300,15 @@ depend on NuGet packages. This mode is useful for verifying that packages work w build scenarios. For completeness, and debugging of automated builds, this section documents behavior of "package mode". To switch to "package mode", set the `ReferenceType` parameter in `build.proj` to `Package`. And, optionally, include -one or more of the following parameters: +one or both of the following parameters: -- `PackageVersionAbstractions` -- `PackageVersionAkvProvider` -- `PackageVersionAzure` -- `PackageVersionLogging` -- `PackageVersionSqlClient` -- `PackageVersionSqlServer` +- `PackageVersionSqlClient` — the version for the entire SqlClient family. +- `PackageVersionSqlServer` — the version for `Microsoft.SqlServer.Server`. -These parameters pull double duty. In targets where the package is being built, the parameter sets the version of the -package. In targets where the package is being referenced, the parameter sets the version of the package that is being -referenced. +These parameters pull double duty. In targets where a package is being built, the parameter sets the version of the +package. In targets where a package is being referenced, the parameter sets the version of the referenced package. +Because the SqlClient family shares one version, `PackageVersionSqlClient` covers every family package, whether it is +being built or referenced. If these parameters are not specified, the latest version, as defined in the `Versions.props` file, will be used. @@ -318,23 +318,23 @@ run subsequent `build.proj` targets against them. ### Examples -Build Microsoft.Data.SqlClient version 7.1.1 that references Microsoft.Data.SqlClient.Extensions.Abstractions v1.0.1 -and Microsoft.Data.SqlClient.Internal.Logging v2.2.2. +Build Microsoft.Data.SqlClient version 7.1.1 in package mode. Because all SqlClient family packages share the same +version, a single `-p:PackageVersionSqlClient=7.1.1` applies to SqlClient and its family dependencies (Abstractions and +Logging). -Build v2.2.2 of Logging and copy to packages: +Build v7.1.1 of Logging and copy to packages: ```bash -dotnet build -t:PackLogging -p:ReferenceType=Package -p:PackageVersionLogging=2.2.2 +dotnet build -t:PackLogging -p:ReferenceType=Package -p:PackageVersionSqlClient=7.1.1 cp artifacts/Microsoft.Data.SqlClient.Internal.Logging/Debug/*.*pkg packages/ ``` -Build v1.0.1 of Abstractions that depends on v2.2.2 of Logging: +Build v7.1.1 of Abstractions (which depends on v7.1.1 of Logging): ```bash dotnet build -t:PackAbstractions \ -p:ReferenceType=Package \ - -p:PackageVersionAbstractions=1.0.1 \ - -p:PackageVersionLogging=2.2.2 + -p:PackageVersionSqlClient=7.1.1 cp artifacts/Microsoft.Data.SqlClient.Extensions.Abstractions/Package-Debug/*.*pkg packages/ ``` @@ -343,9 +343,7 @@ Build SqlClient: ```bash dotnet build -t:PackSqlClient \ -p:ReferenceType=Package \ - -p:PackageVersionSqlClient=7.1.1 \ - -p:PackageVersionAbstractions=1.0.1 \ - -p:PackageVersionLogging=2.2.2 + -p:PackageVersionSqlClient=7.1.1 cp artifacts/Microsoft.Data.SqlClient/Package-Debug/*.*pkg packages/ ``` @@ -354,9 +352,7 @@ Run Microsoft.Data.SqlClient functional tests against the versions built above: ```bash dotnet build -t:TestSqlClientFunctional \ -p:ReferenceType=Package \ - -p:PackageVersionSqlClient=7.1.1 \ - -p:PackageVersionAbstractions=1.0.1 \ - -p:PackageVersionLogging=2.2.2 + -p:PackageVersionSqlClient=7.1.1 ``` Manual test prerequisites and configuration are covered in [TESTGUIDE.md](TESTGUIDE.md#manual-test-prerequisites). diff --git a/Directory.Packages.props b/Directory.Packages.props index 59839f2351..245c716d33 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,28 +4,27 @@ + - - - - - @@ -58,36 +57,38 @@ $([MSBuild]::Add($(SqlServerPackageVersion.Trim().Split('.')[0]), 1)).0.0 - $([MSBuild]::Add($(LoggingPackageVersion.Trim().Split('.')[0]), 1)).0.0 - $([MSBuild]::Add($(AbstractionsPackageVersion.Trim().Split('.')[0]), 1)).0.0 $([MSBuild]::Add($(SqlClientPackageVersion.Trim().Split('.')[0]), 1)).0.0 - $([MSBuild]::Add($(AzurePackageVersion.Trim().Split('.')[0]), 1)).0.0 - $([MSBuild]::Add($(AkvProviderPackageVersion.Trim().Split('.')[0]), 1)).0.0 - + + Version="[$(SqlClientPackageVersion), $(SqlClientVersionCeiling))" /> + Version="[$(SqlClientPackageVersion), $(SqlClientVersionCeiling))" /> + Version="[$(SqlClientPackageVersion), $(SqlClientVersionCeiling))" /> + Version="[$(SqlClientPackageVersion), $(SqlClientVersionCeiling))" /> diff --git a/build.proj b/build.proj index 4ff29a08df..b36ef3deab 100644 --- a/build.proj +++ b/build.proj @@ -89,99 +89,31 @@ - - - -p:AbstractionsPackageVersion=$(PackageVersionAbstractions) - - - - - - -p:AkvProviderPackageVersion=$(PackageVersionAkvProvider) - - - - - - -p:AzurePackageVersion=$(PackageVersionAzure) - - - - - - -p:LoggingPackageVersion=$(PackageVersionLogging) - + $(PackageVersionSqlClientArgument) + $(PackageVersionSqlClientArgument) + $(PackageVersionSqlClientArgument) + $(PackageVersionSqlClientArgument) + + + + + + + <_Cmd>"$(DotnetPath)dotnet" build "$(SqlClientProjectPath)" -getProperty:SqlClientPackageVersion $(BuildNumberArgument) $(BuildSuffixArgument) + <_Cmd>$([System.Text.RegularExpressions.Regex]::Replace($(_Cmd), "\s+", " ")) + + + + + + <_Cmd>"$(DotnetPath)dotnet" build "$(SqlClientProjectPath)" -getProperty:SqlClientFileVersion $(BuildNumberArgument) $(BuildSuffixArgument) + <_Cmd>$([System.Text.RegularExpressions.Regex]::Replace($(_Cmd), "\s+", " ")) + + + + + + + + + + + <_Cmd>"$(DotnetPath)dotnet" build "$(SqlServerProjectPath)" -getProperty:SqlServerPackageVersion $(BuildNumberArgument) $(BuildSuffixArgument) + <_Cmd>$([System.Text.RegularExpressions.Regex]::Replace($(_Cmd), "\s+", " ")) + + + + + + + + + <_Cmd>"$(DotnetPath)dotnet" build "$(SqlServerProjectPath)" -getProperty:SqlServerFileVersion $(BuildNumberArgument) $(BuildSuffixArgument) + <_Cmd>$([System.Text.RegularExpressions.Regex]::Replace($(_Cmd), "\s+", " ")) + + + + + + + + + + + diff --git a/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj index 203aabd1f5..e2636ac11e 100644 --- a/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj +++ b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj @@ -12,14 +12,13 @@ - - + - $(AkvProviderAssemblyVersion) - $(AkvProviderFileVersion) - $(AkvProviderPackageVersion) + $(SqlClientAssemblyVersion) + $(SqlClientFileVersion) + $(SqlClientPackageVersion) diff --git a/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Versions.props b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Versions.props deleted file mode 100644 index dd9ddc03d5..0000000000 --- a/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Versions.props +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - true - - - - - - 7.1.0-preview1 - - - - - - - - $(AkvProviderPackageVersion.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(AkvProviderVersionDefault)-$(BuildSuffix)$(BuildNumber) - $(AkvProviderVersionDefault) - - $(AkvProviderVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(AkvProviderVersionDefault)-dev - $(AkvProviderVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(AkvProviderFileVersion.Split('.')[0]).0.0.0 - - diff --git a/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj b/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj index 0a9d29aa1e..e8b3c55ba0 100644 --- a/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj +++ b/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj @@ -22,14 +22,13 @@ - - + - $(AbstractionsAssemblyVersion) - $(AbstractionsFileVersion) - $(AbstractionsPackageVersion) + $(SqlClientAssemblyVersion) + $(SqlClientFileVersion) + $(SqlClientPackageVersion) diff --git a/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Versions.props b/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Versions.props deleted file mode 100644 index cc6d4ca14a..0000000000 --- a/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Versions.props +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - true - - - - - - 1.1.0-preview1 - - - - - - - - $(AbstractionsPackageVersion.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(AbstractionsVersionDefault)-$(BuildSuffix)$(BuildNumber) - $(AbstractionsVersionDefault) - - $(AbstractionsVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(AbstractionsVersionDefault)-dev - $(AbstractionsVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(AbstractionsFileVersion.Split('.')[0]).0.0.0 - - diff --git a/src/Microsoft.Data.SqlClient.Extensions/Azure/src/ActiveDirectoryAuthenticationProvider.cs b/src/Microsoft.Data.SqlClient.Extensions/Azure/src/ActiveDirectoryAuthenticationProvider.cs index 7a39bb808f..0b8b9bf2d8 100644 --- a/src/Microsoft.Data.SqlClient.Extensions/Azure/src/ActiveDirectoryAuthenticationProvider.cs +++ b/src/Microsoft.Data.SqlClient.Extensions/Azure/src/ActiveDirectoryAuthenticationProvider.cs @@ -798,7 +798,7 @@ private IPublicClientApplication CreateClientAppInstance(PublicClientAppKey publ { ClientId = publicClientAppKey.ApplicationClientId, ClientName = typeof(ActiveDirectoryAuthenticationProvider).FullName, - ClientVersion = Extensions.Azure.ThisAssembly.InformationalVersion, + ClientVersion = Extensions.Azure.ThisAssembly.FileVersion, RedirectUri = publicClientAppKey.RedirectUri, }) // The Authority contains the tenant-specific Entra ID endpoint, e.g. diff --git a/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Azure.csproj b/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Azure.csproj index b9a3b82c27..da0a4cb4c7 100644 --- a/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Azure.csproj +++ b/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Azure.csproj @@ -22,14 +22,13 @@ - - + - $(AzureAssemblyVersion) - $(AzureFileVersion) - $(AzurePackageVersion) + $(SqlClientAssemblyVersion) + $(SqlClientFileVersion) + $(SqlClientPackageVersion) diff --git a/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Versions.props b/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Versions.props deleted file mode 100644 index 636face4e6..0000000000 --- a/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Versions.props +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - true - - - - - - 1.1.0-preview1 - - - - - - - - $(AzurePackageVersion.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(AzureVersionDefault)-$(BuildSuffix)$(BuildNumber) - $(AzureVersionDefault) - - $(AzureVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(AzureVersionDefault)-dev - $(AzureVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(AzureFileVersion.Split('.')[0]).0.0.0 - - diff --git a/src/Microsoft.Data.SqlClient.Internal/Logging/src/Logging.csproj b/src/Microsoft.Data.SqlClient.Internal/Logging/src/Logging.csproj index d1c3e0fc5c..d83b8ae577 100644 --- a/src/Microsoft.Data.SqlClient.Internal/Logging/src/Logging.csproj +++ b/src/Microsoft.Data.SqlClient.Internal/Logging/src/Logging.csproj @@ -24,14 +24,13 @@ - - + - $(LoggingAssemblyVersion) - $(LoggingFileVersion) - $(LoggingPackageVersion) + $(SqlClientAssemblyVersion) + $(SqlClientFileVersion) + $(SqlClientPackageVersion) diff --git a/src/Microsoft.Data.SqlClient.Internal/Logging/src/Versions.props b/src/Microsoft.Data.SqlClient.Internal/Logging/src/Versions.props deleted file mode 100644 index 9d031d21d0..0000000000 --- a/src/Microsoft.Data.SqlClient.Internal/Logging/src/Versions.props +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - true - - - - - - 1.1.0-preview1 - - - - - - - - $(LoggingPackageVersion.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(LoggingVersionDefault)-$(BuildSuffix)$(BuildNumber) - $(LoggingVersionDefault) - - $(LoggingVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(LoggingVersionDefault)-dev - $(LoggingVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) - - - - - - - $(LoggingFileVersion.Split('.')[0]).0.0.0 - - diff --git a/src/Microsoft.Data.SqlClient/Versions.props b/src/Microsoft.Data.SqlClient/Versions.props index 712263b73e..823d1d7bec 100644 --- a/src/Microsoft.Data.SqlClient/Versions.props +++ b/src/Microsoft.Data.SqlClient/Versions.props @@ -14,10 +14,15 @@ --> true @@ -26,10 +31,11 @@ - 7.1.0-preview1 + 7.1.0-preview1 @@ -61,10 +67,10 @@ build pipelines to generate production-ready builds. --> - $(SqlClientVersionDefault)-$(BuildSuffix)$(BuildNumber) - $(SqlClientVersionDefault) + $(SqlClientNextVersion)-$(BuildSuffix)$(BuildNumber) + $(SqlClientNextVersion) - $(SqlClientVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + $(SqlClientNextVersion.Split('-')[0]).$(FileVersionBuildNumber) @@ -76,8 +82,8 @@ want a quick build without supplying any parameters. --> - $(SqlClientVersionDefault)-dev - $(SqlClientVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + $(SqlClientNextVersion)-dev + $(SqlClientNextVersion.Split('-')[0]).$(FileVersionBuildNumber) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj index 06eaf9e914..a54a159921 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj @@ -101,8 +101,6 @@ $(RepoRoot)/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj $(RepoRoot)/src/Microsoft.Data.SqlClient.Internal/Logging/src/Logging.csproj - $(RepoRoot)/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Versions.props - $(RepoRoot)/src/Microsoft.Data.SqlClient.Internal/Logging/src/Versions.props $(RepoRoot)/src/Microsoft.SqlServer.Server/Versions.props @@ -146,13 +144,11 @@ - - @@ -196,27 +192,25 @@ - <_AbstractionsPackageVersionTrimmed>$([System.String]::Copy('$(AbstractionsPackageVersion)').Trim()) - <_LoggingPackageVersionTrimmed>$([System.String]::Copy('$(LoggingPackageVersion)').Trim()) + <_SqlClientPackageVersionTrimmed>$([System.String]::Copy('$(SqlClientPackageVersion)').Trim()) <_SqlServerPackageVersionTrimmed>$([System.String]::Copy('$(SqlServerPackageVersion)').Trim()) - - + - <_AbstractionsVersionRange>[$(_AbstractionsPackageVersionTrimmed), $([MSBuild]::Add($(_AbstractionsPackageVersionTrimmed.Split('.')[0]), 1)).0.0) - <_LoggingVersionRange>[$(_LoggingPackageVersionTrimmed), $([MSBuild]::Add($(_LoggingPackageVersionTrimmed.Split('.')[0]), 1)).0.0) + <_SqlClientVersionRange>[$(_SqlClientPackageVersionTrimmed), $([MSBuild]::Add($(_SqlClientPackageVersionTrimmed.Split('.')[0]), 1)).0.0) <_SqlServerVersionRange>[$(_SqlServerPackageVersionTrimmed), $([MSBuild]::Add($(_SqlServerPackageVersionTrimmed.Split('.')[0]), 1)).0.0) - <_SqlClientPackNuspecExpandedText>$([System.IO.File]::ReadAllText('$(SqlClientPackNuspecTemplatePath)').Replace('$AbstractionsVersionRange$','$(_AbstractionsVersionRange)').Replace('$LoggingVersionRange$','$(_LoggingVersionRange)').Replace('$SqlServerVersionRange$','$(_SqlServerVersionRange)').Replace('$SniVersionRange$','$(SniVersionRange)')) + <_SqlClientPackNuspecExpandedText>$([System.IO.File]::ReadAllText('$(SqlClientPackNuspecTemplatePath)').Replace('$SqlClientVersionRange$','$(_SqlClientVersionRange)').Replace('$SqlServerVersionRange$','$(_SqlServerVersionRange)').Replace('$SniVersionRange$','$(SniVersionRange)')) - - + + @@ -56,8 +56,8 @@ - - + + @@ -68,8 +68,8 @@ - - + + @@ -81,8 +81,8 @@ - - + + diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs index 568592072d..3e764ea7ed 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs @@ -806,7 +806,7 @@ internal static Version GetAssemblyVersion() // NOTE: Using lazy thread-safety since we don't care if two threads both happen to update the value at the same time if (s_systemDataVersion is null) { - s_systemDataVersion = new Version(ThisAssembly.InformationalVersion); + s_systemDataVersion = new Version(ThisAssembly.FileVersion); } return s_systemDataVersion; diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Diagnostics/SqlDiagnosticListener.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Diagnostics/SqlDiagnosticListener.cs index 9ed25cc8d8..40e4bb63d9 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Diagnostics/SqlDiagnosticListener.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Diagnostics/SqlDiagnosticListener.cs @@ -246,7 +246,7 @@ public void WriteConnectionOpenAfter( Stopwatch.GetTimestamp(), sqlConnection.ClientConnectionId, sqlConnection, - ThisAssembly.InformationalVersion, + ThisAssembly.FileVersion, sqlConnection.Statistics?.GetDictionary() ) ); @@ -269,7 +269,7 @@ public Guid WriteConnectionOpenBefore(SqlConnection sqlConnection, [CallerMember operation, Stopwatch.GetTimestamp(), sqlConnection, - ThisAssembly.InformationalVersion + ThisAssembly.FileVersion ) ); @@ -297,7 +297,7 @@ public void WriteConnectionOpenError( Stopwatch.GetTimestamp(), sqlConnection.ClientConnectionId, sqlConnection, - ThisAssembly.InformationalVersion, + ThisAssembly.FileVersion, ex ) ); diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/UserAgent.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/UserAgent.cs index a8fcf7ca88..6b04443813 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/UserAgent.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/UserAgent.cs @@ -145,7 +145,7 @@ static UserAgent() MaxLenOverall, PayloadVersion, DriverName, - ThisAssembly.NuGetPackageVersion, + ThisAssembly.PackageVersion, RuntimeInformation.ProcessArchitecture, osType, RuntimeInformation.OSDescription, diff --git a/src/Microsoft.Data.SqlClient/tests/StressTests/SqlClient.Stress.Runner/Program.cs b/src/Microsoft.Data.SqlClient/tests/StressTests/SqlClient.Stress.Runner/Program.cs index da1ce59316..82108043eb 100644 --- a/src/Microsoft.Data.SqlClient/tests/StressTests/SqlClient.Stress.Runner/Program.cs +++ b/src/Microsoft.Data.SqlClient/tests/StressTests/SqlClient.Stress.Runner/Program.cs @@ -256,20 +256,14 @@ private static string GetMdsVersion() return ""; } - // Look for the NuGetPackageVersion field, which is available in - // newer MDS packages. + // Look for the PackageVersion field, falling back to FileVersion. var field = type.GetField( - "NuGetPackageVersion", + "PackageVersion", + BindingFlags.NonPublic | BindingFlags.Static) + ?? type.GetField( + "FileVersion", BindingFlags.NonPublic | BindingFlags.Static); - // If not present, use the older assembly file version field. - if (field is null) - { - field = type.GetField( - "InformationalVersion", - BindingFlags.NonPublic | BindingFlags.Static); - } - if (field is null) { return ""; diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/UserAgentTests.cs b/src/Microsoft.Data.SqlClient/tests/UnitTests/UserAgentTests.cs index 8331fdb654..80b826700e 100644 --- a/src/Microsoft.Data.SqlClient/tests/UnitTests/UserAgentTests.cs +++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/UserAgentTests.cs @@ -78,7 +78,7 @@ public void Value_Runtime_Parts() Assert.Equal(7, parts.Length); Assert.Equal("1", parts[0]); Assert.Equal("MS-MDS", parts[1]); - Assert.Equal(ThisAssembly.NuGetPackageVersion, parts[2]); + Assert.Equal(ThisAssembly.PackageVersion, parts[2]); // Architecture must be non-empty and 10 characters or less. Assert.True(parts[3] == "Unknown" || parts[3].Length > 0); diff --git a/src/Microsoft.SqlServer.Server/Versions.props b/src/Microsoft.SqlServer.Server/Versions.props index 3615bd95a8..fdee1160fa 100644 --- a/src/Microsoft.SqlServer.Server/Versions.props +++ b/src/Microsoft.SqlServer.Server/Versions.props @@ -25,12 +25,15 @@ + + 1.0.0 + - 1.1.0-preview1 + 1.1.0-preview1 @@ -62,10 +65,10 @@ build pipelines to generate production-ready builds. --> - $(SqlServerVersionDefault)-$(BuildSuffix)$(BuildNumber) - $(SqlServerVersionDefault) + $(SqlServerNextVersion)-$(BuildSuffix)$(BuildNumber) + $(SqlServerNextVersion) - $(SqlServerVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + $(SqlServerNextVersion.Split('-')[0]).$(FileVersionBuildNumber) @@ -77,8 +80,8 @@ want a quick build without supplying any parameters. --> - $(SqlServerVersionDefault)-dev - $(SqlServerVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + $(SqlServerNextVersion)-dev + $(SqlServerNextVersion.Split('-')[0]).$(FileVersionBuildNumber) diff --git a/tools/targets/GenerateThisAssemblyCs.targets b/tools/targets/GenerateThisAssemblyCs.targets index 6ed66d74ed..29844fbce3 100644 --- a/tools/targets/GenerateThisAssemblyCs.targets +++ b/tools/targets/GenerateThisAssemblyCs.targets @@ -8,9 +8,6 @@ - - $(FileVersion) - $(AssemblyName) @@ -22,8 +19,8 @@ namespace $(ThisAssemblyNamespace) { internal static class ThisAssembly { - internal const string InformationalVersion = "$(AssemblyFileVersion)"%3B - internal const string NuGetPackageVersion = "$(Version)"%3B + internal const string FileVersion = "$(FileVersion)"%3B + internal const string PackageVersion = "$(Version)"%3B } }