Skip to content

Commit 7ce7143

Browse files
committed
Merge remote-tracking branch 'refs/remotes/upstream/main' into dev/mdaigle/pwsh-via-dotnet-tool
# Conflicts: # BUILDGUIDE.md # eng/pipelines/onebranch/jobs/build-signed-csproj-package-job.yml # eng/pipelines/onebranch/jobs/build-signed-sqlclient-package-job.yml # tools/targets/CompareMdsRefAssemblies.targets # tools/targets/TrimDocsForIntelliSense.targets
2 parents 0f6413e + 959d2fc commit 7ce7143

298 files changed

Lines changed: 15773 additions & 57067 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111

1212
## 📚 Project Overview
1313
This project is a .NET data provider for SQL Server, enabling .NET applications to interact with SQL Server databases. It supports various features like connection pooling, transaction management, and asynchronous operations.
14-
The project builds from a **single unified project** at `src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj` that multi-targets `net462`, `net8.0`, and `net9.0`. The legacy `netfx/` and `netcore/` directories are being phased out — only their `ref/` folders (which define the public API surface) remain active.
14+
The project builds from a **single unified project** at `src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj`. It targets `net8.0` and `net9.0` on all supported hosts, and adds `net462` only when building on Windows. The legacy `netfx/` and `netcore/` directories are being phased out — only their `ref/` folders (which define the public API surface) remain active.
1515
The project includes:
1616
- **Public APIs**: Defined in `netcore/ref/` and `netfx/ref/` directories.
1717
- **Implementations**: All source code in `src/Microsoft.Data.SqlClient/src/`.
1818
- **Tests**: Located in the `tests/` directory, covering unit and integration tests.
19-
- **Unit Tests**: Located in `tests/UnitTests/` directory, which includes tests for individual components and methods.
20-
- **Functional Tests**: Located in `tests/FunctionalTests/` directory, which includes tests for various features and functionalities that can be run without a SQL Server instance.
21-
- **Manual Tests**: Located in `tests/ManualTests/` directory, which includes tests that require a SQL Server instance to run.
19+
- **Unit Tests**: Located in `src/Microsoft.Data.SqlClient/tests/UnitTests/`.
20+
- **Functional Tests**: Located in `src/Microsoft.Data.SqlClient/tests/FunctionalTests/`.
21+
- **Manual Tests**: Located in `src/Microsoft.Data.SqlClient/tests/ManualTests/`.
22+
- **Performance/Stress Tests**: Located in `src/Microsoft.Data.SqlClient/tests/PerformanceTests/` and `src/Microsoft.Data.SqlClient/tests/StressTests/`.
2223
- **Documentation**: Found in the `doc/` directory, including API documentation, usage examples.
2324
- **Policies**: Contribution guidelines, coding standards, and review policies in the `policy/` directory.
24-
- **Building**: The project uses MSBuild for building and testing, with configurations and targets defined in the `build.proj` file, whereas instructions are provided in the `BUILDGUIDE.md` file.
25+
- **Building**: The repo uses `build.proj` for orchestrated build/test/pack workflows, `src/Microsoft.Data.SqlClient.slnx` for solution-centric development tooling, and Azure DevOps YAML under `eng/pipelines/` plus `eng/pipelines/onebranch/` for CI and official release flows. See `BUILDGUIDE.md` for local build details.
2526
- **CI/CD**: ADO Pipelines for CI/CD and Pull request validation are defined in the `eng/` directory, ensuring code quality and automated testing.
2627

2728
## 📦 Products

.github/instructions/ado-pipelines.instructions.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ Top-level CI/PR pipeline files:
2222
- `dotnet-sqlclient-ci-project-reference-pipeline.yml` — CI with Project references (Release)
2323
- `sqlclient-pr-package-ref-pipeline.yml` — PR validation with Package references
2424
- `sqlclient-pr-project-ref-pipeline.yml` — PR validation with Project references
25-
- `stress-tests-pipeline.yml` — Stress tests triggered after successful CI-Package runs
25+
- `stress/stress-tests-pipeline.yml` — Stress test pipeline and templates
2626

2727
Reusable templates are organized under:
2828
- `common/templates/jobs/` — Job templates (`ci-build-nugets-job`, `ci-code-coverage-job`, `ci-run-tests-job`)
2929
- `common/templates/stages/` — Stage templates (`ci-run-tests-stage`)
3030
- `common/templates/steps/` — Step templates (build, test, config, publish)
3131
- `jobs/` — Package-specific CI jobs (pack/test Abstractions, Azure, Logging, stress)
32-
- `stages/` — Package-specific CI stages (build Logging → AbstractionsSqlClientAzureverify → stress)
32+
- `stages/` — Package-specific CI stages (generate secrets, build SqlServer/Logging/Abstractions/SqlClient/Azure, verify packages)
3333
- `libraries/` — Shared variables (`ci-build-variables.yml`)
3434
- `steps/` — SDK install steps
3535

@@ -43,25 +43,28 @@ Key parameters:
4343
- `testJobTimeout` (required) — test job timeout in minutes
4444
- `targetFrameworks` — Windows test TFMs; default `[net462, net8.0, net9.0, net10.0]`
4545
- `targetFrameworksUnix` — Unix test TFMs; default `[net8.0, net9.0, net10.0]`
46+
- `netcoreVersionTestUtils` — default runtime for shared test utilities; default `net10.0`
4647
- `testSets` — test partitions; default `[1, 2, 3]`
4748
- `useManagedSNI` — SNI variants to test; default `[false, true]`
4849
- `runAlwaysEncryptedTests` — include AE test set; default `true`
49-
- `enableStressTests`enable stress test stage; default `false`
50+
- `runLegacySqlTests`include SQL Server 2016/2017 manual-test legs; default `true`
5051
- `debug` — enable debug output; default `false`
5152
- `dotnetVerbosity` — MSBuild verbosity; default `normal`
5253

5354
## Build Stage Order
5455

5556
Stages execute in dependency order (Package reference mode requires artifacts from prior stages):
5657
1. `generate_secrets` — Generate test secrets
57-
2. `build_logging_package_stage` — Build Logging package
58-
3. `build_abstractions_package_stage` — Build Abstractions (depends on Logging)
59-
4. `build_sqlclient_package_stage` — Build SqlClient + AKV Provider (depends on Abstractions + Logging)
60-
5. `build_azure_package_stage` — Build Azure extensions (depends on Abstractions + Logging + SqlClient)
61-
6. `verify_nuget_packages_stage`Verify NuGet package metadata
62-
7. `stress_tests_stage`Optional stress tests
58+
2. `build_sqlserver_package_stage` — Build `Microsoft.SqlServer.Server`
59+
3. `build_logging_package_stage` — Build Logging package
60+
4. `build_abstractions_package_stage` — Build Abstractions (package mode depends on Logging)
61+
5. `build_sqlclient_package_stage` — Build SqlClient and produce the AKV provider package
62+
6. `build_azure_package_stage`Build Azure extensions
63+
7. `verify_nuget_packages_stage`Verify NuGet package metadata
6364
8. `ci_run_tests_stage` — Run MDS and AKV test suites
6465

66+
Stress testing is no longer a stage threaded through `dotnet-sqlclient-ci-core.yml`; it lives under `eng/pipelines/stress/` as a separate pipeline flow.
67+
6568
When adding a new build stage, respect the dependency graph and pass artifact names/versions to downstream stages.
6669

6770
## PR vs CI Pipeline Differences
@@ -70,12 +73,12 @@ PR pipelines:
7073
- Trigger on PRs to `dev/*`, `feat/*`, `main`; exclude `eng/pipelines/onebranch/*` paths
7174
- Use reduced TFM matrix: `[net462, net8.0, net9.0]` (excludes net10.0)
7275
- Timeout: 90 minutes
73-
- Package-ref PR disables Always Encrypted tests in Debug config
76+
- Package-ref PR disables Always Encrypted tests in Debug config and also disables legacy SQL Server test legs to keep validation fast
7477

7578
CI pipelines:
7679
- Trigger on push to `main` (GitHub) and `internal/main` (ADO) with `batch: true`
7780
- Scheduled weekday builds (see individual pipeline files for cron times)
78-
- Full TFM matrix including net10.0
81+
- Full TFM matrix including net10.0 test legs and legacy SQL Server manual-test coverage
7982

8083
## Test Configuration
8184

@@ -97,7 +100,7 @@ Flaky test quarantine:
97100

98101
SNI testing — `useManagedSNI` controls testing with native SNI (`false`) or managed SNI (`true`)
99102

100-
Test timeout — `--blame-hang-timeout 10m` (configured in `build.proj`); tests exceeding 10 minutes are killed
103+
Test timeout — `--blame-hang-timeout 10m` (configured in `build.proj` and threaded through CI test steps); tests exceeding 10 minutes are killed
101104

102105
## Variables
103106

.github/instructions/architecture.instructions.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ src/
3434
## Unified Project Model
3535

3636
### Architecture Goal
37-
The driver is transitioning away from separate `netfx/` and `netcore/` project files toward a **single unified project** at `src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj`. This project multi-targets all supported frameworks from one codebase:
37+
The driver is transitioning away from separate `netfx/` and `netcore/` project files toward a **single unified project** at `src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj`. This project targets the modern .NET TFMs on every host and conditionally adds .NET Framework on Windows:
3838

3939
```xml
40-
<TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks>
40+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
41+
<TargetFrameworks Condition="'$(NormalizedTargetOs)' == 'windows_nt'">$(TargetFrameworks);net462</TargetFrameworks>
4142
```
4243

4344
**All new code MUST go into `src/Microsoft.Data.SqlClient/src/`**. Do NOT add files to the legacy `netcore/src/` or `netfx/src/` directories.
@@ -82,7 +83,7 @@ When writing code that differs by platform, use these preprocessor directives:
8283
| `#if _UNIX` | Code for Unix/Linux/macOS OS (any framework) |
8384

8485
Guidelines:
85-
1. All code must compile for all target frameworks (`net462`, `net8.0`, `net9.0`)
86+
1. All code must compile for the TFMs supported by the current target OS: `net8.0`/`net9.0` everywhere, plus `net462` on Windows builds
8687
2. Use `#if NETFRAMEWORK` or `#if NET` for framework-specific code paths
8788
3. Use `#if _WINDOWS` or `#if _UNIX` for OS-specific code paths
8889
4. Avoid APIs that don't exist on a target platform without conditional compilation
@@ -104,11 +105,15 @@ The `ref/` directories define the public API surface:
104105
**IMPORTANT**: Any public API changes MUST update the corresponding reference assembly in the appropriate `ref/` directory.
105106

106107
### Build Output
107-
Build artifacts are organized by framework and OS:
108+
Build artifacts are organized by reference mode, configuration, OS, and framework:
108109
```
109-
artifacts/Microsoft.Data.SqlClient/{Configuration}/{TargetOs}/{TargetFramework}/
110+
artifacts/Microsoft.Data.SqlClient/{ReferenceType}-{Configuration}/{NormalizedTargetOs}/{TargetFramework}/
110111
```
111112

113+
`ReferenceType` is a first-class build dimension in this branch. Local and CI builds may run in:
114+
- `Project` mode — sibling packages referenced as projects
115+
- `Package` mode — sibling packages restored from locally produced NuGet packages
116+
112117
## SNI (SQL Server Network Interface) Layer
113118

114119
Two implementations exist:

.github/instructions/onebranch-pipeline-design.instructions.md

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ Defined in `stages/build-stages.yml`. Four build stages plus validation, ordered
3434
- **`build_abstractions`** (Stage 2) — Abstractions; `dependsOn: build_independent`; downloads Logging artifact
3535
- **`build_dependent`** (Stage 3) — SqlClient and Extensions.Azure in parallel; `dependsOn: build_abstractions`; downloads Abstractions + Logging artifacts
3636
- **`build_addons`** (Stage 4) — AKV Provider; `dependsOn: build_dependent`; downloads SqlClient + Abstractions + Logging artifacts
37-
- **`mds_package_validation`** — Validates signed SqlClient package; `dependsOn: build_dependent`; runs in parallel with Stage 4
37+
- **`sqlclient_package_validation`** — Validates signed SqlClient package; `dependsOn: build_dependent`; runs in parallel with Stage 4
38+
39+
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/`.
3840

3941
Stage conditional rules:
4042
- Wrap stages/jobs in `${{ if }}` compile-time conditionals based on build parameters
@@ -45,16 +47,30 @@ Stage conditional rules:
4547

4648
## Job Templates
4749

48-
- **`build-signed-csproj-package-job.yml`** — Generic job for csproj-based packages (Logging, SqlServer.Server, Abstractions, Azure, AKV Provider). Flow: Build DLLs → ESRP DLL signing → NuGet pack (`NoBuild=true`) → ESRP NuGet signing
49-
- **`build-signed-sqlclient-package-job.yml`** — SqlClient-specific job (nuspec-based). Flow: Build all configurations → ESRP DLL signing (main + resource DLLs) → NuGet pack via nuspec → ESRP NuGet signing
50+
- **`build-buildproj-job.yml`** — Shared build.proj-driven package job used for all shipped packages. Flow: build via `build.proj` → optional ESRP DLL signing → pack via `build.proj` → optional ESRP NuGet signing → copy outputs for APIScan/artifacts
5051
- **`validate-signed-package-job.yml`** — Validates signed MDS package (signature, strong names, folder structure, target frameworks)
5152
- **`publish-nuget-package-job.yml`** — Reusable release job using OneBranch `templateContext.type: releaseJob` with `inputs` for artifact download; pushes via `NuGetCommand@2`
53+
- **`publish-symbols-job.yml`** — Reusable symbols job: downloads a build artifact, locates PDBs under `symbols/`, and invokes `publish-symbols-step.yml`
5254

53-
When adding a new csproj-based package:
54-
- Use `build-signed-csproj-package-job.yml` with appropriate `packageName`, `packageFullName`, `versionProperties`, and `downloadArtifacts`
55-
- Add build and pack targets to `build.proj`
55+
When adding a new package to the OneBranch flow:
56+
- Extend `build-buildproj-job.yml` inputs with the new package metadata and dependency artifacts
57+
- Add or update the corresponding build/pack targets in `build.proj`
5658
- Add version variables to `variables/common-variables.yml`
57-
- Add artifact name variable to `variables/onebranch-variables.yml`
59+
- Add artifact name variables to `variables/onebranch-variables.yml`
60+
61+
## Symbols Publishing Stage
62+
63+
- Defined in `stages/publish-symbols-stage.yml`; produces stage `publish_symbols`
64+
- Entire stage excluded at compile time when `publishSymbols` is false
65+
- `dependsOn` is conditional based on which `build*` parameters are set, mirroring the build stage dependency graph
66+
- One job per package (`publish-symbols-job.yml`), each downloading its build artifact and publishing PDBs from `symbols/`
67+
- Each package's PDBs are published separately with unique artifact names and version information
68+
- Build jobs copy PDBs into `$(JOB_OUTPUT)/symbols/` so they are included in the auto-published artifact
69+
- The `publish-symbols-step.yml` accepts a `symbolsFolder` parameter to point at the downloaded PDB location
70+
- The publish step calls an extracted `publish-symbols.ps1` script with structured error handling and diagnostic logging
71+
- Symbols publishing credentials come from the `Symbols Publishing` variable group
72+
- In the official pipeline, symbol server destination follows `releaseToProduction`: Production when true, PPE when false
73+
- Non-official pipeline always targets the PPE symbol server
5874

5975
## Release Stage
6076

@@ -84,7 +100,9 @@ Release parameters (all boolean, default `false`):
84100
- `releaseSqlServerServer`, `releaseLogging`, `releaseAbstractions`, `releaseSqlClient`, `releaseAzure`, `releaseAKVProvider`
85101

86102
Official-only parameter:
87-
- `releaseToProduction` — push to NuGet Production feed (default `false`)
103+
- `releaseToProduction` — controls both NuGet target feed and symbol server destination (default `false`):
104+
- `true` → NuGet Production feed + Production symbol server
105+
- `false` → NuGet Test feed + PPE symbol server
88106

89107
When `isPreview` is true, pipeline resolves `effective*Version` variables to preview versions; otherwise GA versions. All versions defined in `variables/common-variables.yml`.
90108

@@ -98,32 +116,34 @@ When `isPreview` is true, pipeline resolves `effective*Version` variables to pre
98116
- When adding a new package, add GA version, preview version, and assembly file version entries
99117

100118
Variable groups:
101-
- `Release Variables` — release configuration (in `common-variables.yml`)
102-
- `Symbols publishing` — symbol publishing credentials (in `common-variables.yml`)
119+
- `Symbols Publishing` — symbol publishing credentials (in `onebranch-variables.yml`)
103120
- `ESRP Federated Creds (AME)` — ESRP signing credentials (in `common-variables.yml`)
104121

105122
## Code Signing (ESRP)
106123

107124
- Uses ESRP v6 tasks (`EsrpMalwareScanning@6`, `EsrpCodeSigning@6`) with MSI/federated identity authentication
108125
- Signing only runs when `isOfficial: true` — non-official pipelines skip ESRP steps
109-
- csproj-based packages: sign DLLs first → pack with `NoBuild=true` → sign NuGet package (ensures NuGet contains signed DLLs)
110-
- SqlClient: sign DLLs (including resource DLLs) → nuspec pack → sign NuGet package
126+
- The shared OneBranch job signs DLLs before packing and signs the resulting NuGet package afterward so the published package contains signed binaries
111127
- DLL signing uses keyCode `CP-230012` (Authenticode); NuGet signing uses keyCode `CP-401405`
112128
- All ESRP credentials come from variable groups — never hardcode secrets in YAML
113129

114130
## SDL and Compliance
115131

116132
- TSA: enabled only in official pipeline; disabled in non-official to avoid spurious alerts
117133
- ApiScan: enabled in both; currently `break: false` pending package registration
118-
- Each build job sets `ob_sdl_apiscan_*` variables pointing to `$(Build.SourcesDirectory)/apiScan/<PackageName>/`
134+
- Each build job sets `ob_sdl_apiscan_softwareFolder` to `$(JOB_OUTPUT)/assemblies` and `ob_sdl_apiscan_symbolsFolder` to `$(JOB_OUTPUT)/symbols`
119135
- CodeQL, SBOM, Policheck (`break: true`): enabled in both pipelines
120136
- asyncSdl `enabled: false` in both; individual sub-tools (CredScan, BinSkim, Armory, Roslyn) configured underneath
121137
- Policheck exclusions: `$(REPO_ROOT)\.config\PolicheckExclusions.xml`
122138
- CredScan suppressions: `$(REPO_ROOT)/.config/CredScanSuppressions.json`
123139

124140
## Artifact Conventions
125141

126-
- `ob_outputDirectory` set to `$(PACK_OUTPUT)` (= `$(REPO_ROOT)/output`) — OneBranch auto-publishes this directory
142+
- `ob_outputDirectory` set to `$(JOB_OUTPUT)` (= `$(REPO_ROOT)/output`) — OneBranch auto-publishes this directory
143+
- Each published artifact uses subdirectories to separate file types:
144+
- `assemblies/` — DLL assemblies for APIScan (preserving TFM folder structure)
145+
- `packages/` — NuGet packages (`.nupkg`, `.snupkg`)
146+
- `symbols/` — PDB symbol files (preserving TFM folder structure, shared by APIScan and symbol publishing)
127147
- Artifact names follow `drop_<stageName>_<jobName>` — defined in `variables/onebranch-variables.yml`
128148
- Downstream jobs download artifacts via `DownloadPipelineArtifact@2` into `$(Build.SourcesDirectory)/packages`
129149
- Downloaded packages serve as a local NuGet source for `dotnet restore`

0 commit comments

Comments
 (0)