diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 4c80da66ff..0c78f461cb 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -11,17 +11,18 @@ ## 📚 Project Overview 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. -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. +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. The project includes: - **Public APIs**: Defined in `netcore/ref/` and `netfx/ref/` directories. - **Implementations**: All source code in `src/Microsoft.Data.SqlClient/src/`. - **Tests**: Located in the `tests/` directory, covering unit and integration tests. - - **Unit Tests**: Located in `tests/UnitTests/` directory, which includes tests for individual components and methods. - - **Functional Tests**: Located in `tests/FunctionalTests/` directory, which includes tests for various features and functionalities that can be run without a SQL Server instance. - - **Manual Tests**: Located in `tests/ManualTests/` directory, which includes tests that require a SQL Server instance to run. + - **Unit Tests**: Located in `src/Microsoft.Data.SqlClient/tests/UnitTests/`. + - **Functional Tests**: Located in `src/Microsoft.Data.SqlClient/tests/FunctionalTests/`. + - **Manual Tests**: Located in `src/Microsoft.Data.SqlClient/tests/ManualTests/`. + - **Performance/Stress Tests**: Located in `src/Microsoft.Data.SqlClient/tests/PerformanceTests/` and `src/Microsoft.Data.SqlClient/tests/StressTests/`. - **Documentation**: Found in the `doc/` directory, including API documentation, usage examples. - **Policies**: Contribution guidelines, coding standards, and review policies in the `policy/` directory. -- **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. +- **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. - **CI/CD**: ADO Pipelines for CI/CD and Pull request validation are defined in the `eng/` directory, ensuring code quality and automated testing. ## 📦 Products diff --git a/.github/instructions/ado-pipelines.instructions.md b/.github/instructions/ado-pipelines.instructions.md index db053130e0..5dfd35a12c 100644 --- a/.github/instructions/ado-pipelines.instructions.md +++ b/.github/instructions/ado-pipelines.instructions.md @@ -22,14 +22,14 @@ Top-level CI/PR pipeline files: - `dotnet-sqlclient-ci-project-reference-pipeline.yml` — CI with Project references (Release) - `sqlclient-pr-package-ref-pipeline.yml` — PR validation with Package references - `sqlclient-pr-project-ref-pipeline.yml` — PR validation with Project references -- `stress-tests-pipeline.yml` — Stress tests triggered after successful CI-Package runs +- `stress/stress-tests-pipeline.yml` — Stress test pipeline and templates Reusable templates are organized under: - `common/templates/jobs/` — Job templates (`ci-build-nugets-job`, `ci-code-coverage-job`, `ci-run-tests-job`) - `common/templates/stages/` — Stage templates (`ci-run-tests-stage`) - `common/templates/steps/` — Step templates (build, test, config, publish) - `jobs/` — Package-specific CI jobs (pack/test Abstractions, Azure, Logging, stress) -- `stages/` — Package-specific CI stages (build Logging → Abstractions → SqlClient → Azure → verify → stress) +- `stages/` — Package-specific CI stages (generate secrets, build SqlServer/Logging/Abstractions/SqlClient/Azure, verify packages) - `libraries/` — Shared variables (`ci-build-variables.yml`) - `steps/` — SDK install steps @@ -43,10 +43,11 @@ Key parameters: - `testJobTimeout` (required) — test job timeout in minutes - `targetFrameworks` — Windows test TFMs; default `[net462, net8.0, net9.0, net10.0]` - `targetFrameworksUnix` — Unix test TFMs; default `[net8.0, net9.0, net10.0]` +- `netcoreVersionTestUtils` — default runtime for shared test utilities; default `net10.0` - `testSets` — test partitions; default `[1, 2, 3]` - `useManagedSNI` — SNI variants to test; default `[false, true]` - `runAlwaysEncryptedTests` — include AE test set; default `true` -- `enableStressTests` — enable stress test stage; default `false` +- `runLegacySqlTests` — include SQL Server 2016/2017 manual-test legs; default `true` - `debug` — enable debug output; default `false` - `dotnetVerbosity` — MSBuild verbosity; default `normal` @@ -54,14 +55,16 @@ Key parameters: Stages execute in dependency order (Package reference mode requires artifacts from prior stages): 1. `generate_secrets` — Generate test secrets -2. `build_logging_package_stage` — Build Logging package -3. `build_abstractions_package_stage` — Build Abstractions (depends on Logging) -4. `build_sqlclient_package_stage` — Build SqlClient + AKV Provider (depends on Abstractions + Logging) -5. `build_azure_package_stage` — Build Azure extensions (depends on Abstractions + Logging + SqlClient) -6. `verify_nuget_packages_stage` — Verify NuGet package metadata -7. `stress_tests_stage` — Optional stress tests +2. `build_sqlserver_package_stage` — Build `Microsoft.SqlServer.Server` +3. `build_logging_package_stage` — Build Logging package +4. `build_abstractions_package_stage` — Build Abstractions (package mode depends on Logging) +5. `build_sqlclient_package_stage` — Build SqlClient and produce the AKV provider package +6. `build_azure_package_stage` — Build Azure extensions +7. `verify_nuget_packages_stage` — Verify NuGet package metadata 8. `ci_run_tests_stage` — Run MDS and AKV test suites +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. + When adding a new build stage, respect the dependency graph and pass artifact names/versions to downstream stages. ## PR vs CI Pipeline Differences @@ -70,12 +73,12 @@ PR pipelines: - Trigger on PRs to `dev/*`, `feat/*`, `main`; exclude `eng/pipelines/onebranch/*` paths - Use reduced TFM matrix: `[net462, net8.0, net9.0]` (excludes net10.0) - Timeout: 90 minutes -- Package-ref PR disables Always Encrypted tests in Debug config +- Package-ref PR disables Always Encrypted tests in Debug config and also disables legacy SQL Server test legs to keep validation fast CI pipelines: - Trigger on push to `main` (GitHub) and `internal/main` (ADO) with `batch: true` - Scheduled weekday builds (see individual pipeline files for cron times) -- Full TFM matrix including net10.0 +- Full TFM matrix including net10.0 test legs and legacy SQL Server manual-test coverage ## Test Configuration @@ -97,7 +100,7 @@ Flaky test quarantine: SNI testing — `useManagedSNI` controls testing with native SNI (`false`) or managed SNI (`true`) -Test timeout — `--blame-hang-timeout 10m` (configured in `build.proj`); tests exceeding 10 minutes are killed +Test timeout — `--blame-hang-timeout 10m` (configured in `build.proj` and threaded through CI test steps); tests exceeding 10 minutes are killed ## Variables diff --git a/.github/instructions/onebranch-pipeline-design.instructions.md b/.github/instructions/onebranch-pipeline-design.instructions.md index f1520fa0e0..2421674eef 100644 --- a/.github/instructions/onebranch-pipeline-design.instructions.md +++ b/.github/instructions/onebranch-pipeline-design.instructions.md @@ -34,7 +34,7 @@ Defined in `stages/build-stages.yml`. Four build stages plus validation, ordered - **`build_abstractions`** (Stage 2) — Abstractions; `dependsOn: build_independent`; downloads Logging artifact - **`build_dependent`** (Stage 3) — SqlClient and Extensions.Azure in parallel; `dependsOn: build_abstractions`; downloads Abstractions + Logging artifacts - **`build_addons`** (Stage 4) — AKV Provider; `dependsOn: build_dependent`; downloads SqlClient + Abstractions + Logging artifacts -- **`mds_package_validation`** — Validates signed SqlClient package; `dependsOn: build_dependent`; runs in parallel with Stage 4 +- **`sqlclient_package_validation`** — Validates signed SqlClient package; `dependsOn: build_dependent`; runs in parallel with Stage 4 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/`. @@ -47,17 +47,16 @@ Stage conditional rules: ## Job Templates -- **`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 → Copy PDBs to artifact -- **`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 → Copy PDBs to artifact +- **`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 - **`validate-signed-package-job.yml`** — Validates signed MDS package (signature, strong names, folder structure, target frameworks) - **`publish-nuget-package-job.yml`** — Reusable release job using OneBranch `templateContext.type: releaseJob` with `inputs` for artifact download; pushes via `NuGetCommand@2` - **`publish-symbols-job.yml`** — Reusable symbols job: downloads a build artifact, locates PDBs under `symbols/`, and invokes `publish-symbols-step.yml` -When adding a new csproj-based package: -- Use `build-signed-csproj-package-job.yml` with appropriate `packageName`, `packageFullName`, `versionProperties`, and `downloadArtifacts` -- Add build and pack targets to `build.proj` +When adding a new package to the OneBranch flow: +- Extend `build-buildproj-job.yml` inputs with the new package metadata and dependency artifacts +- Add or update the corresponding build/pack targets in `build.proj` - Add version variables to `variables/common-variables.yml` -- Add artifact name variable to `variables/onebranch-variables.yml` +- Add artifact name variables to `variables/onebranch-variables.yml` ## Symbols Publishing Stage @@ -124,8 +123,7 @@ Variable groups: - Uses ESRP v6 tasks (`EsrpMalwareScanning@6`, `EsrpCodeSigning@6`) with MSI/federated identity authentication - Signing only runs when `isOfficial: true` — non-official pipelines skip ESRP steps -- csproj-based packages: sign DLLs first → pack with `NoBuild=true` → sign NuGet package (ensures NuGet contains signed DLLs) -- SqlClient: sign DLLs (including resource DLLs) → nuspec pack → sign NuGet package +- The shared OneBranch job signs DLLs before packing and signs the resulting NuGet package afterward so the published package contains signed binaries - DLL signing uses keyCode `CP-230012` (Authenticode); NuGet signing uses keyCode `CP-401405` - All ESRP credentials come from variable groups — never hardcode secrets in YAML diff --git a/.github/prompts/ado-work-item-agent.prompt.md b/.github/prompts/ado-work-item-agent.prompt.md index 6eb6319ef6..e94d667bac 100644 --- a/.github/prompts/ado-work-item-agent.prompt.md +++ b/.github/prompts/ado-work-item-agent.prompt.md @@ -23,7 +23,7 @@ Perform the following steps to address the work item. Think step-by-step. - Locate the relevant code in `src/` or `tests/`. ### 2. Planning and Branching -- Propose a descriptive branch name following the pattern `dev/username/branch-name` (e.g., `dev/jdoe/fix-connection-pool`). +- Propose a descriptive branch name following the repository rule `dev/automation/` (e.g., `dev/automation/fix-connection-pool`). - Identify any dependencies or potential breaking changes. ### 3. Implementation @@ -33,13 +33,13 @@ Perform the following steps to address the work item. Think step-by-step. ### 4. Testing and Verification - **Mandatory**: All changes must be tested. -- Create new unit tests in `tests/UnitTests` or functional tests in `tests/FunctionalTests` as appropriate. +- Create new unit tests in `src/Microsoft.Data.SqlClient/tests/UnitTests` or functional tests in `src/Microsoft.Data.SqlClient/tests/FunctionalTests` as appropriate. - Verify that the tests pass. ### 5. Documentation and Finalization - If public APIs are modified, update the documentation in `doc/`. - Provide a clear summary of changes for the Pull Request. -- Suggest an entry for [CHANGELOG.md](CHANGELOG.md) if the change is significant. +- Suggest a release-note entry under `release-notes/` or in the PR description if the change is significant; do not edit `CHANGELOG.md` directly. ## Input **Work Item ID**: ${input:workItemId} diff --git a/.github/prompts/fix-bug.prompt.md b/.github/prompts/fix-bug.prompt.md index 47b143f31f..ade780708d 100644 --- a/.github/prompts/fix-bug.prompt.md +++ b/.github/prompts/fix-bug.prompt.md @@ -25,9 +25,9 @@ Follow this workflow step-by-step: ## 3. Write a Failing Test - Create a test that reproduces the bug BEFORE implementing the fix. - Choose the correct test project: - - `tests/UnitTests/` — for isolated logic tests (no SQL Server needed) - - `tests/FunctionalTests/` — for API behavior tests (no SQL Server needed) - - `tests/ManualTests/` — for integration tests (requires SQL Server) + - `src/Microsoft.Data.SqlClient/tests/UnitTests/` — for isolated logic tests (no SQL Server needed) + - `src/Microsoft.Data.SqlClient/tests/FunctionalTests/` — for API behavior tests (no SQL Server needed) + - `src/Microsoft.Data.SqlClient/tests/ManualTests/` — for integration tests (requires SQL Server) - Follow existing naming conventions: `{ClassName}Tests.cs` with methods named `{MethodName}_{Scenario}_{ExpectedResult}`. - If the bug is platform-specific, add appropriate `[ConditionalFact]` or `[ConditionalTheory]` attributes with `[PlatformSpecific]`. - **Cover both sync and async code paths** if the affected API has both variants (e.g., `Open`/`OpenAsync`, `ExecuteReader`/`ExecuteReaderAsync`). Sync and async paths often have different internal implementations and a bug may manifest in only one. diff --git a/.github/prompts/implement-feature.prompt.md b/.github/prompts/implement-feature.prompt.md index 4beae539fe..4623cb235c 100644 --- a/.github/prompts/implement-feature.prompt.md +++ b/.github/prompts/implement-feature.prompt.md @@ -62,9 +62,9 @@ Before writing code, produce a brief implementation plan covering: 4. Test against multiple SQL Server versions. ## 5. Write Tests -- **Unit tests** in `tests/UnitTests/` for isolated logic. -- **Functional tests** in `tests/FunctionalTests/` for API behavior without SQL Server. -- **Manual tests** in `tests/ManualTests/` for full integration with SQL Server. +- **Unit tests** in `src/Microsoft.Data.SqlClient/tests/UnitTests/` for isolated logic. +- **Functional tests** in `src/Microsoft.Data.SqlClient/tests/FunctionalTests/` for API behavior without SQL Server. +- **Manual tests** in `src/Microsoft.Data.SqlClient/tests/ManualTests/` for full integration with SQL Server. - Cover: - Happy path and edge cases - **Both sync and async code paths** where the feature exposes both variants diff --git a/.github/prompts/release-notes.prompt.md b/.github/prompts/release-notes.prompt.md index 55cc7785e2..8fffa30392 100644 --- a/.github/prompts/release-notes.prompt.md +++ b/.github/prompts/release-notes.prompt.md @@ -28,7 +28,7 @@ Each package has its own versioning and dependency sources. Use these to determi | Package | Version Source | Dependency Source | |---------|---------------|-------------------| | `Microsoft.Data.SqlClient` | [tools/props/Versions.props](tools/props/Versions.props) (`MdsVersionDefault`) | [Directory.Packages.props](Directory.Packages.props) and the [project file](src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj) | -| `AzureKeyVaultProvider` | [tools/props/Versions.props](tools/props/Versions.props) (`AkvVersionDefault`) | [AKV project file](src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj) and [Directory.Packages.props](Directory.Packages.props) | +| `AzureKeyVaultProvider` | [tools/props/Versions.props](tools/props/Versions.props) (`AkvVersionDefault`) | [AKV project file](src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj) and [Directory.Packages.props](Directory.Packages.props) | | `Microsoft.SqlServer.Server` | [tools/props/Versions.props](tools/props/Versions.props) (`SqlServerPackageVersion`) | [SqlServer project file](src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj) | | `Extensions.Abstractions` | [AbstractionsVersions.props](src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/AbstractionsVersions.props) | [Abstractions.csproj](src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj) | | `Extensions.Azure` | [AzureVersions.props](src/Microsoft.Data.SqlClient.Extensions/Azure/src/AzureVersions.props) | [Azure.csproj](src/Microsoft.Data.SqlClient.Extensions/Azure/src/Azure.csproj) | diff --git a/.github/prompts/update-build-pipelines.prompt.md b/.github/prompts/update-build-pipelines.prompt.md index a4715fa000..63c87ea9c3 100644 --- a/.github/prompts/update-build-pipelines.prompt.md +++ b/.github/prompts/update-build-pipelines.prompt.md @@ -15,35 +15,40 @@ Follow this workflow step-by-step: ## 1. Understand the Pipeline Architecture - Read the relevant pipeline file(s) in `eng/pipelines/`. - Key pipelines: - - `dotnet-sqlclient-ci-core.yml` — Core CI pipeline (reusable by reference pipelines) + - `dotnet-sqlclient-ci-core.yml` — Core CI pipeline template used by CI and PR definitions - `dotnet-sqlclient-ci-project-reference-pipeline.yml` — CI with project references - `dotnet-sqlclient-ci-package-reference-pipeline.yml` — CI with package references - `sqlclient-pr-project-ref-pipeline.yml` — PR validation (project references) - `sqlclient-pr-package-ref-pipeline.yml` — PR validation (package references) - - `dotnet-sqlclient-signing-pipeline.yml` — Package signing - - `akv-official-pipeline.yml` — AKV provider official build (1ES/OneBranch) - - `stress-tests-pipeline.yml` — Stress tests + - `onebranch/sqlclient-official.yml` — official OneBranch build/release pipeline + - `onebranch/sqlclient-non-official.yml` — non-official OneBranch build/release pipeline + - `stress/stress-tests-pipeline.yml` — stress test pipeline - Shared templates live in `eng/pipelines/common/templates/` (jobs/, stages/, steps/). -- Variables are defined in `eng/pipelines/variables/` and `eng/pipelines/libraries/`. +- CI variables are defined in `eng/pipelines/libraries/`; OneBranch variables are defined in `eng/pipelines/onebranch/variables/`. ## 2. Identify What Needs to Change - Determine which pipeline files are affected. - Check if the change impacts shared templates that are reused across multiple pipelines. - Identify if new parameters, variables, or stages need to be added. - Review existing parameters to understand the current configuration surface: - - `targetFrameworks` / `targetFrameworksUnix` — test target frameworks + - `targetFrameworks` / `targetFrameworksUnix` — Windows and Unix test TFMs + - `netcoreVersionTestUtils` — runtime used by shared test utilities - `referenceType` — Project or Package reference - `buildConfiguration` — Debug/Release - `useManagedSNI` — Managed vs Native SNI testing + - `runLegacySqlTests` — whether to include SQL Server 2016/2017 legs ## 3. Implement the Change - Modify YAML files following the existing patterns and indentation style. - When adding new stages, follow the existing stage ordering: - 1. `build_abstractions_package_stage` - 2. `build_sqlclient_package_stage` - 3. `build_azure_package_stage` - 4. `stress_tests_stage` (optional) - 5. `run_tests_stage` + 1. `generate_secrets` + 2. `build_sqlserver_package_stage` + 3. `build_logging_package_stage` + 4. `build_abstractions_package_stage` + 5. `build_sqlclient_package_stage` + 6. `build_azure_package_stage` + 7. `verify_nuget_packages_stage` + 8. `ci_run_tests_stage` - When adding new test parameters, ensure they are wired through to test execution steps. - When modifying shared templates, verify all consuming pipelines still work. @@ -52,6 +57,7 @@ Follow this workflow step-by-step: - Test filters by platform: `nonnetfxtests`, `nonnetcoreapptests`, `nonwindowstests`, `nonlinuxtests`. - SNI testing matrix: both Native (`useManagedSNI=false`) and Managed (`useManagedSNI=true`). - Always Encrypted tests controlled by `runAlwaysEncryptedTests` parameter. +- Stress coverage is maintained under `eng/pipelines/stress/`, not as a stage inside `dotnet-sqlclient-ci-core.yml`. ## 5. Validate - Verify YAML syntax is valid. diff --git a/BUILDGUIDE.md b/BUILDGUIDE.md index 5da2e2ffd6..7c8e4acb93 100644 --- a/BUILDGUIDE.md +++ b/BUILDGUIDE.md @@ -1,271 +1,318 @@ -# Guidelines for Building Microsoft.Data.SqlClient +# Build Guide for Microsoft.Data.SqlClient and Related Packages -This document provides all the necessary details to build the driver and run tests present in the repository. +This document provides details on how to build the Microsoft.Data.SqlClient package and the other related packages +contained within this repository. ## Prerequisites ### .NET SDK +Projects in this repository require the .NET SDK to be installed in order to build. For the exact version required for +building the current version, see [global.json](global.json). Downloads for .NET SDK can be found at: +https://dotnet.microsoft.com/en-us/download/dotnet -The projects in this repo require the .NET 10.0 SDK to build. Please ensure you -have the latest version of that SDK installed. +The .NET SDK contains support for building for previous versions of .NET, including support for building .NET Framework +on operating systems that do not support .NET Framework. As such, it is not necessary to install any version of the +.NET SDK aside from the version specified in [global.json](global.json). -Tests and tools may require different .NET Runtimes that may be installed -independently. For example, tests targeting .NET 8.0 will need that runtime -installed. +### Miscellaneous -### Visual Studio +**Powershell** is required to run several miscellaneous tasks as part of building and packaging. On Windows systems, +no action is required. On Linux and MacOS systems, the `pwsh` command is required to be in the `$PATH` environment +variable. For specific instructions see: [Install PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/install-powershell) -This project should be built with Visual Studio 2019+ for the best compatibility. The required set of components are provided in the below file: +The **NuGet** binary is required to package the Microsoft.Data.SqlClient project. For convenience, this can be be done +via the PowerShell script [tools/scripts/downloadLatestNuget.ps1](tools/scripts/downloadLatestNuget.ps1), however, any +`nuget.exe` binary can be used. -- **Visual Studio 2019** with imported components: [VS19Components](/tools/vsconfig/VS19Components.vsconfig) +## Developer Workflow -- **Powershell**: To build SqlClient on Linux, powershell is needed as well. Follow the distro specific instructions at [Install Powershell on Linux](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux?view=powershell-7.4) +Once you've cloned the repository and made your changes to the codebase, it is time to build, test, and optionally +package the project. The `build.proj` file provides convenient targets to accomplish these tasks. -Once the environment is setup properly, execute the desired set of commands below from the _root_ folder to perform the respective operations: +> [!NOTE] +> Although every effort has been made to make building and testing work in your IDE of choice, some quirks in behavior +> may be noticed, possibly severe. All official build and test infrastructure uses the `build.proj` entrypoint, and it +> is recommended that `build.proj` is used for local development, as well. -### Manual Test Prerequisites +> [!TIP] +> `build.proj` was written with the intention of being called from `msbuild`. As such, the following examples below +> use `msbuild`. On systems where `msbuild` is not available, simply replace `msbuild` with `dotnet msbuild` to get the +> same behavior. -Manual Tests require the below setup to run: +> [!TIP] +> This section is not exhaustive of all targets or parameters to `build.proj`. Complete documentation is avilable in +> [`build.proj`](build.proj). -- SQL Server with enabled Shared Memory, TCP and Named Pipes Protocols and access to the Client OS. -- Databases "NORTHWIND" and "UdtTestDb" present in SQL Server, created using SQL scripts [createNorthwindDb.sql](tools/testsql/createNorthwindDb.sql) and [createUdtTestDb.sql](tools/testsql/createUdtTestDb.sql). To setup an Azure Database with "NORTHWIND" tables, use SQL Script: [createNorthwindAzureDb.sql](tools/testsql/createNorthwindAzureDb.sql). -- Make a copy of the configuration file [config.default.json](src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json) and rename it to `config.json`. Update the values in `config.json`: +### Building Projects - |Property|Description|Value| - |------|--------|-------------------| - |TCPConnectionString | Connection String for a TCP enabled SQL Server instance. | `Server={servername};Database={Database_Name};Trusted_Connection=True;`
OR `Data Source={servername};Initial Catalog={Database_Name};Integrated Security=True;`| - |NPConnectionString | Connection String for a Named Pipes enabled SQL Server instance.| `Server=\\{servername}\pipe\sql\query;Database={Database_Name};Trusted_Connection=True;`
OR
`Data Source=np:{servername};Initial Catalog={Database_Name};Integrated Security=True;`| - |TCPConnectionStringHGSVBS | (Optional) Connection String for a TCP enabled SQL Server with Host Guardian Service (HGS) attestation protocol configuration. | `Server=tcp:{servername}; Database={Database_Name}; UID={UID}; PWD={PWD}; Attestation Protocol = HGS; Enclave Attestation Url = {AttestationURL};`| - |TCPConnectionStringNoneVBS | (Optional) Connection String for a TCP enabled SQL Server with a VBS Enclave and using None Attestation protocol configuration. | `Server=tcp:{servername}; Database={Database_Name}; UID={UID}; PWD={PWD}; Attestation Protocol = NONE;`| - |TCPConnectionStringAASSGX | (Optional) Connection String for a TCP enabled SQL Server with a SGX Enclave and using Microsoft Azure Attestation (AAS) attestation protocol configuration. | `Server=tcp:{servername}; Database={Database_Name}; UID={UID}; PWD={PWD}; Attestation Protocol = AAS; Enclave Attestation Url = {AttestationURL};`| - |EnclaveEnabled | Enables tests requiring an enclave-configured server.| - |TracingEnabled | Enables EventSource related tests | - |AADAuthorityURL | (Optional) Identifies the OAuth2 authority resource for `Server` specified in `AADPasswordConnectionString` | `https://login.windows.net/`, where `` is the tenant ID of the Entra ID (Azure AD) tenant | - |AADPasswordConnectionString | (Optional) Connection String for testing Entra ID Password Authentication. | `Data Source={server.database.windows.net}; Initial Catalog={Azure_DB_Name};Authentication=Active Directory Password; User ID={AAD_User}; Password={AAD_User_Password};`| - |AADSecurePrincipalId | (Optional) The Application Id of a registered application which has been granted permission to the database defined in the AADPasswordConnectionString. | {Application ID} | - |AADSecurePrincipalSecret | (Optional) A Secret defined for a registered application which has been granted permission to the database defined in the AADPasswordConnectionString. | {Secret} | - |AzureKeyVaultURL | (Optional) Azure Key Vault Identifier URL | `https://{keyvaultname}.vault.azure.net/` | - |AzureKeyVaultTenantId | (Optional) The Entra ID tenant (directory) Id of the service principal. | _{Tenant ID of Active Directory}_ | - |SupportsIntegratedSecurity | (Optional) Whether or not the USER running tests has integrated security access to the target SQL Server.| `true` OR `false`| - |LocalDbAppName | (Optional) If Local Db Testing is supported, this property configures the name of Local DB App instance available in client environment. Empty string value disables Local Db testing. | Name of Local Db App to connect to.| - |LocalDbSharedInstanceName | (Optional) If LocalDB testing is supported and the instance is shared, this property configures the name of the shared instance of LocalDB to connect to. | Name of shared instance of LocalDB. | - |FileStreamDirectory | (Optional) If File Stream is enabled on SQL Server, pass local directory path to be used for setting up File Stream enabled database. | `D:\\escaped\\absolute\\path\\to\\directory\\` | - |UseManagedSNIOnWindows | (Optional) Enables testing with Managed SNI on Windows| `true` OR `false`| - |DNSCachingConnString | Connection string for a server that supports DNS Caching| - |EnclaveAzureDatabaseConnString | (Optional) Connection string for Azure database with enclaves | - |ManagedIdentitySupported | (Optional) When set to `false` **Managed Identity** related tests won't run. The default value is `true`. | - |IsManagedInstance | (Optional) When set to `true` **TVP** related tests will use non-Azure bsl files to compare test results. This is needed when testing against Azure Managed Instances; otherwise TVP Tests will fail on TestSet 3. The default value is `false`. | - |PowerShellPath | The full path to PowerShell.exe. This is not required if the path is present in the PATH environment variable. | `D:\\escaped\\absolute\\path\\to\\PowerShell.exe` | +From the root of your repository, run `msbuild` against `build.proj` with a build target, following this pattern: -## Test Configuration Environment Variables +```bash +msbuild build.proj -t: [optional_parameters] +``` + +The following build targets can be used to build the following projects. All targets will implicitly build any other +projects they depend on. + +| `` | Description | +|:----------------------------|:--------------------------------------------------------------------------------| +| `Build` | Builds all projects for all platforms | +| `BuildAbstractions` | Builds Microsoft.Data.SqlClient.Extensions.Abstractions | +| `BuildAkvProvider` | Builds Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider | +| `BuildAzure` | Builds Microsoft.Data.SqlClient.Extensions.Azure | +| `BuildLogging` | Builds Microsoft.Data.SqlClient.Internal.Logging | +| `BuildSqlClient` | Builds all variants of Microsoft.Data.SqlClient, for all platforms | +| `BuildSqlClientRef` | Builds the reference assemblies for Microsoft.Data.SqlClient | +| `BuildSqlClientUnsupported` | Builds the "unsupported platform" assemblies for Microsoft.Data.SqlClient | +| `BuildSqlClientUnix` | Builds the Unix-specific implementation binaries of Microsoft.Data.SqlClient | +| `BuildSqlClientWindows` | Builds the Windows-specific implementation binaries of Microsoft.Data.SqlClient | +| `BuildSqlServer` | Builds Microsoft.SqlServer.Server | + +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. Assembly and file versions are derived from this, if it is provided. See Versioning for more details | + +For most projects, build output is placed in `artifacts//Project-/`. `` +is the full name of the package, `` is the build configuration, and `` is the target framework +moniker. SqlClient deviates slightly from this convention, since it consists of multiple projects and the +implementation project is OS-specific. Implementation project output is placed in +`artifacts/Microsoft.Data.SqlClient/Project-//`. The unsupported platform assemblies are placed +in `artifacts/Microsoft.Data.SqlClient.unsupported/Project-/`, and the reference assemblies are +placed in `artifacts/Microsoft.Data.SqlClient.ref/Project-/`. + +#### Examples + +Build all projects: +```bash +msbuild build.proj -t:Build +``` -Environment variables can be used to override test configuration without modifying `config.json` -files directly. This is useful when running tests via the command line, in CI/CD pipelines, -containerized environments, or when switching between configurations frequently. +Build Microsoft.Data.SqlClient in Release configuration: +```bash +msbuild build.proj -t:BuildSqlClient -p:Configuration=Release +``` -### Main Test Suite (`Microsoft.Data.SqlClient.TestUtilities`) +Build v1.2.3 of Microsoft.Data.SqlClient.Extensions.Abstractions: +```bash +msbuild build.proj -t:BuildAbstractions -p:PackageVersion=1.2.3 +``` -These variables apply to unit, functional, and manual tests. The configuration is defined in -[`Config.cs`](src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Config.cs). +### Testing Projects -| Variable | Description | Default | -|----------|-------------|---------| -| `TEST_MDS_CONFIG` | Override the path to the `config.json` file used by the test runner. | `config.json` (in the working directory) | -| `MDS_TCPConnectionString` | Override the TCP connection string. Takes precedence over the value in `config.json`. | Value from `config.json` | +This section provides a summary and brief example of how to execute tests for projects in this repository. **For more +information about test procedures, including config file setup, see [TESTGUIDE.md](TESTGUIDE.md).** -Example: +From the root of your repository, run `msbuild` against `build.proj` with a test target, following this pattern: ```bash -export TEST_MDS_CONFIG=~/my-test-config.json -export MDS_TCPConnectionString="Server=myserver;Database=mydb;Trusted_Connection=True;" -dotnet test src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj +msbuild build.proj -t: [optional_parameters] ``` -### Performance Tests +| `` | Description | +|----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------| +| `Test` | Runs all tests in the repository for all platforms supported by the host OS. _This will take a considerable amount of time and is not recommended_. | +| `TestAzure` | Runs all tests for Microsoft.Data.SqlClient.Extensions.Azure | +| `TestSqlClient` | Runs all tests for Microsoft.Data.SqlClient. | +| `TestSqlClientFunctional` | Runs the "functional" test project for Microsoft.Data.SqlClient. These are a mix of unit and integration tests against live servers. | +| `TestSqlClientManual` | Runs the "manual" test project for Microsoft.Data.SqlClient. These are generally integration tests against live servers. | +| `TestSqlClientUnit` | Runs the unit test project for Microsoft.Data.SqlClient. These are a mix of unit tests and integration tests against simulated servers. | -These variables apply to performance benchmarks. The configuration is defined in -[`Config.cs`](src/Microsoft.Data.SqlClient/tests/PerformanceTests/Config/Config.cs). +> [!TIP] +> Test targets will automatically build the projects they depend on. Therefore, it is not necessary to explicitly build +> (eg) SqlClient before executing the (eg) functional tests target. -| Variable | Description | Default | -|----------|-------------|---------| -| `RUNNER_CONFIG` | Override the path to the `runnerconfig.json` file used by performance benchmarks. | `runnerconfig.json` (in the DLL output directory) | +A selection of parameters for test targets in `build.proj` relevant to common developer workflows can be found below: -See [Run Performance Tests](#run-performance-tests) for more details. +| `[optional_parameter]` | Default Value | Description | +|------------------------|----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `-p:Configuration=` | `Debug` | Build configuration. Can be `Debug` or `Release`. | +| `-p:DotnetPath=` | `[blank]` | Path to `dotnet` binary to run the test project. This is useful for running tests against x86 platform on a x86_64 machine. Path must end with `\` or `/`. | +| `-p:TestBlameTimeout=` | `10m` | How long to wait on a test before timing it out. Use `0` to disable hang timeouts. | +| `-p:TestFilters=` | `category!=failing&category!=flaky&category!=interactive` | Filters to use to select the xUnit tests to execute. Use `none` to run all possible tests. | +| `-p:TestFramework=` | `[blank]` | Target framework moniker for the version of .NET to use to execute tests. | +| `-p:TestSet=` | `[blank]` | The `TestSqlClientManual` project is very large and is split into multiple sets that can be executed individually. This parameter allows selecting between test sets: `1`, `2`, `3`, and `AE`. | -### Azure Extension Tests +#### Examples -These variables apply to the Azure extension test suite. The configuration is defined in -[`Config.cs`](src/Microsoft.Data.SqlClient.Extensions/Azure/test/Config.cs). +Run Microsoft.Data.SqlClient unit tests: -| Variable | Description | Default | -|----------|-------------|---------| -| `TEST_MDS_CONFIG` | Override the path to the `config.json` file used by Azure extension tests. | `config.json` | -| `ADO_POOL` | Set to any value to indicate tests are running in an Azure DevOps CI pool. | _(unset)_ | -| `SYSTEM_ACCESSTOKEN` | Azure Pipelines system access token, used for workload identity federation tests. | _(unset)_ | -| `TEST_DEBUG_EMIT` | Set to any value to enable debug output of configuration values during test startup. Sensitive values are Base64-encoded. | _(unset)_ | +```bash +msbuild build.proj -t:TestSqlClientUnit +``` -## MSBuild Reference +Run Microsoft.Data.SqlClient manual test set 2: +```bash +msbuild build.proj -t:TestSqlClientManual -p:TestSet=2 +``` -### Targets +Run Microsoft.Data.SqlClient functional tests against x86 dotnet: +```bash +msbuild build.proj -t:TestSqlClientFunctional -p:DotnetPath='C:\path\to\dotnet\x86\' +``` -The following build targets are defined in `build.proj`: +Run all Microsoft.Data.SqlClient.Extensions.Azure unit tests, including interactive, but excluding failing tests: +```bash +msbuild build.proj -t:TestAzure -p:TestFilters=category!=failing +``` -|Target|Description| -|-|-| -|`BuildAbstractions`|Restore and build the Abstractions package.| -|`BuildAkvProvider`|Builds the Azure Key Vault Provider package for all supported platforms.| -|`BuildAllConfigurations`|Default target. Builds the .NET Framework and .NET drivers for all target frameworks and operating systems.| -|`BuildAzure`|Restore and build the Azure package.| -|`BuildLogging`|Restore and build the Logging package.| -|`BuildNetCore`|Builds the .NET driver for all target frameworks.| -|`BuildNetCoreAllOS`|Builds the .NET driver for all target frameworks and operating systems.| -|`BuildNetFx`|Builds the .NET Framework driver for all target frameworks.| -|`BuildSqlClient`|Build the driver for all target frameworks.| -|`Clean`|Cleans all generated files.| -|`PackAbstractions`|Pack the Abstractions NuGet package into `packages/`. Requires `BuildAbstractions` first.| -|`PackAkvProvider`|Pack the Azure Key Vault Provider NuGet package (requires a prior build).| -|`PackAzure`|Pack the Azure NuGet package into `packages/`. Requires `BuildAzure` first.| -|`PackLogging`|Pack the Logging NuGet package into `packages/`. Requires `BuildLogging` first.| -|`Restore`|Restores NuGet packages.| -|`RunTests`|Runs the unit, functional, and manual tests for the .NET Framework and .NET drivers| -|`RunUnitTests`|Runs just the unit tests for the .NET Framework and .NET drivers| -|`RunFunctionalTests`|Runs just the functional tests for the .NET Framework and .NET drivers| -|`RunManualTests`|Runs just the manual tests for the .NET Framework and .NET drivers| +Run Microsoft.Data.SqlClient functional tests against net8.0 runtime: +```bash +msbuild build.proj -t:TestSqlClientFunctional -p:TestFramework=net8.0 +``` -### Parameters +### Packaging Projects -The following parameters may be defined as MSBuild properties to configure the -build: +Just like bulding and testing the various projects in this repository, packaging the projects into NuGet packages is +also handle by `build.proj`. From the root of your repository, run `msbuild` against `build.proj` with a test target, +following this pattern: -|Name|Supported Values|Default|Description| -|-|-|-|-| -|`Configuration`|`Debug`, `Release`|`Debug`|Sets the release configuration.| -|`OSGroup`|`Unix`, `Windows_NT`, `AnyOS`|typically defaults to the client system's OS, unless using `BuildAllConfigurations` or an `AnyOS` specific target|The operating system to target.| -|`Platform`|`AnyCPU`, `x86`, `x64`, `ARM`, `ARM64`|`AnyCPU`|May only be set when using package reference type or running tests.| -|`TestSet`|`1`, `2`, `3`, `AE`, or any combination thereof|`''`|Build or run a subset of the manual tests. Omit (default) to run all tests.| -|`DotnetPath`|Absolute file path to an installed `dotnet` version.|The system default specified by the path variable|Set to run tests using a specific dotnet version (e.g. C:\net6-win-x86\)| -|`TF`|`net8.0`, `net462`, `net47`, `net471`, `net472`, `net48`, `net481`|`net9.0` in netcore, `net462` in netfx|Sets the target framework when building or running tests. Not applicable when building the drivers.| -|`ResultsDirectory`|An absolute file path|./TestResults relative to current directory|Specifies where to write test results.| +```bash +msbuild build.proj -t: [optional_parameters] +``` -## Example Commands to Run Tests Using MSBuild (Recommended) +| `` | Desription | +|--------------------|-------------------------------------------------------------------------------------| +| `Pack` | Packages all projects in the repository. | +| `PackAbstractions` | Packages the Microsoft.Data.SqlClient.Extensions.Abstractions package | +| `PackAkvProvider` | Packages the Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider package | +| `PackAzure` | Packages the Microsoft.Data.SqlClient.Extensions.Azure package | +| `PackLogging` | Packages the Microsoft.Data.SqlClient.Internal.Logging package | +| `PackSqlClient` | Packages the Microsoft.Data.SqlClient package | +| `PackSqlServer` | Packages the Microsoft.SqlServer.Server package | -Using the default configuration and running all tests: +> [!TIP] +> For convenience, the Pack targets will automatically build the target project and any dependencies. -```bash -msbuild -t:RunTests -``` +A selection of parameters for pack targets in `build.proj` relevant to common developer workflows can be found below: + +| `[optional_parameter]` | Default Value | Allowed Values | Description | +|------------------------------------|---------------|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `-p:Configuration=` | `Debug` | `Debug`, `Release` | Build configuration. Only applies if project and dependencies are being built. | +| `-p:NugetPath=` | `[blank]` | eg. `C:\my\nuget.exe` | _Only applies to `PackSqlClient`._ Path to `nuget.exe` that to use. If not provided, defaults to `nuget.exe` in the PATH. | +| `-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. If `PackBuild` is `true`, the assembly and file versions will be derived from this version. See Versioning for more details. | -Using the Release configuration: +#### Examples +Package Microsoft.Data.SqlClient.Internal.Logging into a NuGet package: ```bash -msbuild -t:RunTests -p:Configuration=Release +msbuild build.proj -t:PackLogging ``` -Running only the unit tests: - +Package Microsoft.Data.SqlClient if `nuget.exe` is not in the `$PATH` environment variable: ```bash -msbuild -t:RunUnitTests +msbuild build.proj -t:PackSqlClient -p:NugetPath="C:\my\nuget.exe" ``` -Using a specific .NET runtime to run tests: - +Package version 1.2.3 of Microsoft.Data.SqlClient.Extensions.Abstractions: ```bash -msbuild -t:RunTests -p:DotnetPath=C:\net8-win-x86\ +msbuild build.proj -t:PackAbstractions -p:PackageVersionAbstractions=1.2.3 ``` -To run tests against a specific version of .NET/.NET Framework, set the `-p:TF` parameter. - +Package version Microsoft.Data.SqlClient.Extensions.Azure without building it beforehand: ```bash -msbuild -t:RunTests -p:TF=net8.0 -msbuild -t:RunTests -p:TF=net462 +msbuild build.proj -t:PackAzure -p:PackBuild=false ``` -## Example Commands to Run Tests using `dotnet` +## Versioning -Under the hood, the MSBuild commands to run tests use `dotnet` commands. But, if you wish to run -them without the overhead of wrapping/unwrapping in MSBuild, you can run them directly. +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. -To change the processor architecture that runs the test (where possible, ie, x86 on x64), use the -appropriate `dotnet` executable. +`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`. -By default, the tests will be executed on all supported .NET/.NET framework versions. To run on a -specific version, pass the `-f` parameter with the desired version (eg `net9.0`). +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 `--filter` parameter is used to select which tests run. The default `category!=failing& -category!=flaky&category!=interactive` prevents tests that are known to be failing or flaky from -running. To run a specific test, use `FullyQualifiedName=[fully qualified name of the test method]` -as the filter parameter. To run all possible tests, even known failing and flaky ones, simply omit -the filter parameter. Please note, however, that this will still omit tests that cannot run on the -current platform or with the current test configuration (eg, Windows tests on Linux, or SQL DB tests -when Azure Synapse is configured). +| `PackageVersion` | `BuildNumber` | `BuildSuffix` | Package Version | Assembly Version | File Version | Scenario | +|------------------|---------------|---------------|------------------|------------------|---------------|------------------------------------------------------------| +| N/A | N/A | N/A | `1.2.3-dev` | `1.0.0` | `1.2.3.0` | Standard developer scenario | +| `9.8.7` | N/A | N/A | `9.8.7` | `9.0.0` | `9.8.7.0` | Developer is building a specific version of the package | +| `9.8.7-preview1` | N/A | N/A | `9.8.7-preview1` | `9.0.0` | `9.8.7.0` | Developer is buildins a pre-release version of the package | +| N/A | `1234` | N/A | `1.2.3` | `1.0.0` | `1.2.3.1234` | Automated pipelines building GA releases | +| N/A | `1234` | `ci` | `1.2.3-ci1234` | `1.0.0` | `1.2.3.1234` | Automated pipelines building non-prod releases | -### Run Functional Tests +--- -```bash -dotnet test "src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj" \ - -p:Configuration=Release \ - --filter "category!=failing&category!=flaky&category!=interactive" +## Package Mode Builds -``` +The above documentation is the default mode of operation, and is the recommended mode for most developers. However, +`build.proj` supports "package mode" builds. In this mode, instead of projects depending on other projects, they +depend on NuGet packages. This mode is useful for verifying that packages work with each other, especially in automated +build scenarios. For completeness, and debugging of autoamted builds, this section documents behavior of "package mode". -### Run Manual Tests +To switch to "package mode", set the `ReferenceType` parameter in `build.proj` to `Package`. And, optionally, include +one or more of the following parameters: -```bash -dotnet test "src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj" \ - -p:Configuration=Release \ - --filter "category!=failing&category!=flaky&category!=interactive" -``` +* `PackageVersionAbstractions` +* `PackageVersionAkvProvider` +* `PackageVersionAzure` +* `PackageVersionLogging` +* `PackageVersionSqlClient` +* `PackageVersionSqlServer` -### Run Unit Tests -```bash -dotnet test "src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj" \ - -p:Configuration=Release \ - --filter "category!=failing&category!=flaky&category!=interactive" -``` +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. -## Testing with Package References +If these parameters are not specified, the latest version, as defined in the `Versions.props` file, will be used. -The MDS driver consists of several components, each of which produces its own -NuGet package. During development, components reference each other via -`` properties by default. This means that building -and testing one component will implicitly build its project referenced -dependencies. +The `nuget.config` for this repository defines a local feed that points to the `packages` directory. This allows +developers that need to test against development packages to drop their development packages into this directory, and +run subsequent `build.proj` targets against them. -Alternatively, the `ReferenceType` build property may be specified with a value -of `Package`. This will change inter-component dependencies to use -`` dependencies, and require that dependent components be -built and packaged before building the depending component. This will generate NuGet -packages in the root packages/ directory, and will be automatically searched by NuGet -(see our root `NuGet.config`). +### Examples -Then, you can specify `Package` references be used, for example: +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. ```bash -dotnet build -t:BuildLogging,PackLogging -dotnet build -t:BuildSqlServer,PackSqlServer -dotnet build -t:BuildAbstractions,PackAbstractions -p:ReferenceType=Package -dotnet build -t:BuildAzure,PackAzure -p:ReferenceType=Package -dotnet build -t:BuildSqlClient -p:ReferenceType=Package -dotnet build -t:GenerateMdsPackage -dotnet build -t:BuildAKVNetCore -p:ReferenceType=Package -dotnet build -t:GenerateAkvPackage +# Build v2.2.2 of Logging and copy to packages +msbuild build.proj -t:PackLogging \ + -p:ReferenceType=Package \ + -p:PackageVersionLogging=2.2.2 +cp artifacts/Microsoft.Data.SqlClient.Internal.Logging/Debug/*.*pkg packages/ + +# Build v1.0.1 of Abstractions that depends on v2.2.2 of Logging +msbuild build.proj -t:PackAbstractions \ + -p:ReferenceType=Package \ + -p:PackageVersionAbstractions=1.0.1 \ + -p:PackageVersionLogging=2.2.2 \ +cp artifacts/Microsoft.Data.SqlClient.Extensions.Abstractions/Package-Debug/*.*pkg packages/ + +# Build SqlClient +msbuild -t:PackSqlClient \ + -p:ReferenceType=Package \ + -p:PackageVersionSqlClient=7.1.1 \ + -p:PackageVersionAbstractions=1.0.1 \ + -p:PackageVersionLogging=2.2.2 +cp artifacts/Microsoft.Data.SqlClient/Package-Debug/*.*pkg packages/ ``` -The above will build the MDS and AKV components, place their NuGet packages into -the `packages/` directory. +Run Microsoft.Data.SqlClient functional tests against the versions build above: +```bash +msbuild build.proj -t:TestSqlClientFunctional \ + -p:ReferenceType=Package \ + -p:PackageVersionSqlClient=7.1.1 \ + -p:PackageVersionAbstractions=1.0.1 \ + -p:PackageVersionLogging=2.2.2 +``` -A non-AnyCPU platform reference can only be used with package reference type. -Otherwise, the specified platform will be replaced with AnyCPU in the build -process. +---- -### Running Tests with Reference Type -Provide property to `dotnet test` commands for testing desired reference type. +Manual test prerequisites and configuration are covered in [TESTGUIDE.md](TESTGUIDE.md#manual-test-prerequisites). -```bash -dotnet test -p:ReferenceType=Project ... -``` +--- ## Using Managed SNI on Windows diff --git a/Directory.Packages.props b/Directory.Packages.props index b1a858bf72..62918f7d65 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -40,10 +40,10 @@ Version="$(AzurePackageVersion)" /> + Version="$(SqlClientPackageVersion)" /> + Version="$(AkvProviderPackageVersion)" /> diff --git a/TESTGUIDE.md b/TESTGUIDE.md new file mode 100644 index 0000000000..fdcb8749ec --- /dev/null +++ b/TESTGUIDE.md @@ -0,0 +1,311 @@ +# Test Guide for Microsoft.Data.SqlClient + +This guide describes how to run the test projects in this repository and how to configure the SQL Server-backed manual +tests. + +For build prerequisites and general `build.proj` usage, see [BUILDGUIDE.md](BUILDGUIDE.md). + +## Test Projects + +The primary test projects for Microsoft.Data.SqlClient are under +[src/Microsoft.Data.SqlClient/tests](src/Microsoft.Data.SqlClient/tests): + +| Project | Path | Purpose | +|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------| +| Unit tests | [src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj](src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj) | Unit tests and tests against simulated servers. | +| Functional tests | [src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj](src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj) | Functional tests for public and internal behavior. Some tests use simulated servers or local test infrastructure. | +| Manual tests | [src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj](src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj) | Integration tests that generally require a configured SQL Server or Azure SQL target. | + +These projects target `net8.0`, `net9.0`, and `net10.0` on all platforms. On Windows, they also target `net462`. + +## Recommended Entry Point + +Use [build.proj](build.proj) from the repository root: + +```bash +msbuild build.proj -t: [optional_parameters] +``` + +If `msbuild` is not available, use `dotnet msbuild`: + +```bash +dotnet msbuild build.proj -t: [optional_parameters] +``` + +Test targets build the projects they depend on, so a separate build step is not required for normal test runs. + +## Test Targets + +| Target | Description | +|---------------------------|--------------------------------------------------------------------------------------------------------------------------| +| `Test` | Runs all test targets in the repository. This can take a long time and is not recommended for routine local development. | +| `TestAbstractions` | Runs Microsoft.Data.SqlClient.Extensions.Abstractions tests. | +| `TestAzure` | Runs Microsoft.Data.SqlClient.Extensions.Azure tests. | +| `TestSqlClient` | Runs all Microsoft.Data.SqlClient test projects. | +| `TestSqlClientUnit` | Runs Microsoft.Data.SqlClient unit tests. | +| `TestSqlClientFunctional` | Runs Microsoft.Data.SqlClient functional tests. | +| `TestSqlClientManual` | Runs Microsoft.Data.SqlClient manual tests. | + +## Common Commands + +Run the SqlClient unit tests: + +```bash +msbuild build.proj -t:TestSqlClientUnit +``` + +Run the SqlClient functional tests: + +```bash +msbuild build.proj -t:TestSqlClientFunctional +``` + +Run the SqlClient manual tests: + +```bash +msbuild build.proj -t:TestSqlClientManual +``` + +Run only manual test set 2: + +```bash +msbuild build.proj -t:TestSqlClientManual -p:TestSet=2 +``` + +Run manual test sets 1 and 3: + +```bash +msbuild build.proj -t:TestSqlClientManual -p:TestSet=13 +``` + +Run Always Encrypted manual tests: + +```bash +msbuild build.proj -t:TestSqlClientManual -p:TestSet=AE +``` + +Run a specific target framework: + +```bash +msbuild build.proj -t:TestSqlClientFunctional -p:TestFramework=net8.0 +``` + +Run functional tests against an x86 `dotnet` installation: + +```bash +msbuild build.proj -t:TestSqlClientFunctional -p:DotnetPath='C:\path\to\dotnet\x86\' +``` + +Run all Azure extension tests, including `interactive` tests, while still excluding tests marked `failing` or `flaky`: + +```bash +msbuild build.proj -t:TestAzure -p:TestFilters=category!=failing +``` + +## Test Parameters + +The most commonly used test parameters are: + +| Parameter | Default | Description | +|-----------------------------|-----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------| +| `-p:Configuration=` | `Debug` | Build configuration. Use `Debug` or `Release`. | +| `-p:DotnetPath=` | Empty | Path to the folder containing the `dotnet` binary. The path must end with `\` or `/`. | +| `-p:ReferenceType=` | `Project` | For functional and manual SqlClient tests, use `Project` to test the source project or `Package` to test a package reference. | +| `-p:TestBlameTimeout=` | `10m` | Enables hang blame collection with the specified timeout. Use `0` to disable hang timeouts. | +| `-p:TestCodeCoverage=` | `true` | Collects code coverage when set to `true`. | +| `-p:TestFilters=` | `category!=failing&category!=flaky&category!=interactive` | xUnit filter expression. Use `none` to run without the default filter. | +| `-p:TestFramework=` | Empty | Target framework to run. If omitted, all target frameworks supported by the project and host OS are run. | +| `-p:TestResultsFolderPath=` | `test_results` | Directory where test results are written. | +| `-p:TestSet=` | Empty | Selects manual test sets. Supported values include `1`, `2`, `3`, `AE`, and combinations such as `13` or `12AE`. | + +## Test Filters + +`build.proj` passes `TestFilters` to `dotnet test --filter`. By default, tests marked with these categories are excluded: + +| Category | Why it is excluded by default | +|---------------|-------------------------------------------------------------------------------------| +| `failing` | Known failing tests. | +| `flaky` | Intermittently failing tests. | +| `interactive` | Tests that require user interaction or external setup not suitable for normal runs. | + +Examples: + +```bash +# Run a single test by fully-qualified name. +msbuild build.proj -t:TestSqlClientUnit -p:TestFilters=FullyQualifiedName=Namespace.ClassName.MethodName + +# Run only flaky tests while investigating quarantine failures. +msbuild build.proj -t:TestSqlClientManual -p:TestFilters=category=flaky + +# Disable the default filter. +msbuild build.proj -t:TestSqlClientFunctional -p:TestFilters=none +``` + +When passing filter expressions that contain shell-sensitive characters such as `&`, quote or escape the value as +required by your shell. + +## Running Test Projects Directly + +`build.proj` is the recommended entry point because it keeps logging, code coverage, package-reference mode, and +common parameters consistent. For quick local investigation, you can run a test project directly: + +```bash +dotnet test src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj \ + -p:Configuration=Debug \ + --filter "category!=failing&category!=flaky&category!=interactive" +``` + +For manual tests, pass `TestSet` to the test project when needed: + +```bash +dotnet test src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj \ + -p:Configuration=Debug \ + -p:TestSet=2 \ + --filter "category!=failing&category!=flaky&category!=interactive" +``` + +## Manual Test Prerequisites + +Manual tests require SQL Server or Azure SQL resources and a local test configuration file. + +For a basic local SQL Server run, prepare: + +- A SQL Server instance that the test machine can reach. +- Shared Memory, TCP, and Named Pipes protocols enabled when testing local Windows SQL Server scenarios. +- The `NORTHWIND` database created from [tools/testsql/createNorthwindDb.sql](tools/testsql/createNorthwindDb.sql). For + Azure SQL, use [tools/testsql/createNorthwindAzureDb.sql](tools/testsql/createNorthwindAzureDb.sql). +- The `UdtTestDb` database created from [tools/testsql/createUdtTestDb.sql](tools/testsql/createUdtTestDb.sql) if you + want UDT tests to run. +- A login or integrated-security principal with permissions to create and drop the temporary objects used by the tests. + +Feature-specific tests require additional resources. If those resources are not configured, the corresponding +conditional tests are skipped. + +## Manual Test Configuration + +Edit the source configuration file at `src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/ +config.json`. The test utilities project copies that file to the test output directory, where the manual tests load it +by default. + +The template file is: + +[src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json](src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json) + +`config.json` is git-ignored. If it does not exist, the test utilities project copies `config.default.json` to +`config.json` before compile. You can also create it manually: + +```bash +cp src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json \ + src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.json +``` + +Update `config.json` for your environment before running manual tests. The most important values for a basic run are `TCPConnectionString` and `NPConnectionString`. + +```jsonc +{ + "TCPConnectionString": "Data Source=tcp:localhost;Database=Northwind;Integrated Security=true;Encrypt=false;", + "NPConnectionString": "Data Source=np:localhost;Database=Northwind;Integrated Security=true;Encrypt=false;", + "EnclaveEnabled": false, + "TracingEnabled": false, + "SupportsIntegratedSecurity": true +} +``` + +For SQL Server in a Linux container, WSL, or another host where SQL authentication is easier than integrated security, use a TCP connection string like: + +```jsonc +{ + "TCPConnectionString": "Data Source=tcp:127.0.0.1;User Id=sa;Password=;Database=Northwind;Encrypt=false;TrustServerCertificate=true" +} +``` + +You can override the config file path with the `MDS_TEST_CONFIG` environment variable: + +```bash +MDS_TEST_CONFIG=/path/to/config.json msbuild build.proj -t:TestSqlClientManual -p:TestSet=2 +``` + +On PowerShell: + +```powershell +$env:MDS_TEST_CONFIG = "C:\path\to\config.json" +msbuild build.proj -t:TestSqlClientManual -p:TestSet=2 +``` + +## Configuration Properties + +| Property | Description | Example or notes | +|----------------------------------|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------| +| `TCPConnectionString` | Connection string for a TCP-enabled SQL Server or Azure SQL database. | `Data Source=tcp:localhost;Database=Northwind;Integrated Security=true;Encrypt=false;` | +| `NPConnectionString` | Connection string for a Named Pipes-enabled SQL Server instance. | `Data Source=np:localhost;Database=Northwind;Integrated Security=true;Encrypt=false;` | +| `TCPConnectionStringHGSVBS` | Optional connection string for SQL Server with VBS enclave and HGS attestation. | Include `Attestation Protocol=HGS` and `Enclave Attestation Url`. | +| `TCPConnectionStringNoneVBS` | Optional connection string for SQL Server with VBS enclave and no attestation. | Include `Attestation Protocol=None`. | +| `TCPConnectionStringAASSGX` | Optional connection string for SQL Server with SGX enclave and Microsoft Azure Attestation. | Include `Attestation Protocol=AAS` and `Enclave Attestation Url`. | +| `EnclaveEnabled` | Enables tests that require an enclave-configured server. | `true` or `false`. | +| `TracingEnabled` | Enables tracing-related tests. | `true` or `false`. | +| `AADAuthorityURL` | Optional OAuth authority for `AADPasswordConnectionString`. | `https://login.windows.net/` | +| `AADPasswordConnectionString` | Optional connection string for Microsoft Entra ID password authentication tests. | Uses `Authentication=Active Directory Password`. | +| `AADServicePrincipalId` | Optional application ID for service-principal authentication tests. | Former docs may refer to this as a secure principal ID. | +| `AADServicePrincipalSecret` | Optional application secret for service-principal authentication tests. | Keep this only in local, ignored config files or secure pipeline variables. | +| `AzureKeyVaultURL` | Optional Azure Key Vault URL for Always Encrypted tests. | `https://.vault.azure.net/` | +| `AzureKeyVaultTenantId` | Optional Entra ID tenant ID for Azure Key Vault tests. | Tenant ID GUID. | +| `SupportsIntegratedSecurity` | Whether the user running tests has integrated-security access to the target SQL Server. | `true` or `false`. | +| `LocalDbAppName` | Optional LocalDB instance name. Empty disables LocalDB testing. | `MSSQLLocalDB` or another local instance. | +| `LocalDbSharedInstanceName` | Optional shared LocalDB instance name. | Used only when testing shared LocalDB. | +| `SupportsFileStream` | Whether FileStream tests are supported by the target. | `true` or `false`. | +| `FileStreamDirectory` | Directory used for FileStream database setup. | Use an escaped absolute path in JSON. | +| `UseManagedSNIOnWindows` | Enables Managed SNI on Windows test coverage. | `true` or `false`. | +| `DNSCachingConnString` | Optional connection string for DNS caching tests. | Used with DNS caching server settings. | +| `DNSCachingServerCR` | Optional DNS caching control-ring server. | Feature-specific tests only. | +| `DNSCachingServerTR` | Optional DNS caching tenant-ring server. | Feature-specific tests only. | +| `IsDNSCachingSupportedCR` | Enables DNS caching control-ring tests. | `true` or `false`. | +| `IsDNSCachingSupportedTR` | Enables DNS caching tenant-ring tests. | `true` or `false`. | +| `IsAzureSynapse` | Marks the target as Azure Synapse. | Some SQL Server-specific tests are skipped when `true`. | +| `EnclaveAzureDatabaseConnString` | Optional Azure SQL database connection string for enclave tests. | Feature-specific tests only. | +| `ManagedIdentitySupported` | Whether managed identity tests should run. | Defaults to `true`. Set `false` if unavailable. | +| `UserManagedIdentityClientId` | Optional client ID for user-assigned managed identity tests. | Feature-specific tests only. | +| `KerberosDomainUser` | Optional Kerberos test domain user. | Feature-specific tests only. | +| `KerberosDomainPassword` | Optional Kerberos test domain password. | Keep only in local, ignored config files or secure pipeline variables. | +| `IsManagedInstance` | Marks the target as Azure SQL Managed Instance. | Set `true` for Managed Instance to use non-Azure TVP baseline files in test set 3. | +| `PowerShellPath` | Full path to PowerShell if it is not on `PATH`. | `C:\\escaped\\path\\to\\powershell.exe` | +| `AliasName` | Optional SQL Server alias used by alias-related tests. | Feature-specific tests only. | + +## Manual Test Sets + +The manual test project is split into compile-time sets so large runs can be parallelized. + +| TestSet | Coverage | +|---------|--------------------------------------------------------------------------------------------------------------------------------------------------| +| `1` | Smaller SQL connectivity and command scenarios. | +| `2` | Broad data access coverage, including adapters, bulk copy, retry logic, data reader, schema, DNS caching, and related scenarios. | +| `3` | Additional integration coverage, including LocalDB, pooling, parameters, transactions, JSON, Kerberos, UDT, vector, and other SQL feature tests. | +| `AE` | Always Encrypted tests. | + +If `TestSet` is omitted, all sets are compiled and run. You can combine sets by concatenating values, for example +`-p:TestSet=23` or `-p:TestSet=12AE`. + +## Results and Diagnostics + +Test results are written to `test_results` by default. Override the location with `TestResultsFolderPath`: + +```bash +msbuild build.proj -t:TestSqlClientUnit -p:TestResultsFolderPath=/tmp/sqlclient-test-results +``` + +Hang blame collection is enabled by default with a `10m` timeout. To increase the timeout: + +```bash +msbuild build.proj -t:TestSqlClientManual -p:TestBlameTimeout=30m +``` + +To disable hang blame collection: + +```bash +msbuild build.proj -t:TestSqlClientManual -p:TestBlameTimeout=0 +``` + +Code coverage is enabled by default. To disable it for a faster local run: + +```bash +msbuild build.proj -t:TestSqlClientUnit -p:TestCodeCoverage=false +``` diff --git a/build.proj b/build.proj index f6954667c4..e32caef276 100644 --- a/build.proj +++ b/build.proj @@ -1,270 +1,1022 @@ - + - + + - - false + + + + + -p:BuildNumber=$(BuildNumber) + + + + + -p:BuildSuffix=$(BuildSuffix) + + + Debug - TestResults - - + - - - true - ContinuousIntegrationBuild=$(BuildForRelease);EmbedUntrackedSources=$(BuildForRelease) - + + nuget - - - - - - - + + true + + --no-build + + + BuildSqlClient - - + + + + -p:AbstractionsPackageVersion=$(PackageVersionAbstractions) + - - - $(CommonProperties) + + + + -p:AkvProviderPackageVersion=$(PackageVersionAkvProvider) + - - $(SqlServerProperties);SqlServerPackageVersion=$(SqlServerPackageVersion) - + + + + -p:AzurePackageVersion=$(PackageVersionAbstractions) + - - $(SqlServerProperties);SqlServerAssemblyFileVersion=$(SqlServerAssemblyFileVersion) - - + + + + -p:LoggingPackageVersion=$(PackageVersionLogging) + - - - + + + + -p:SqlClientPackageVersion=$(PackageVersionSqlClient) + - - - + + + + -p:SqlServerPackageVersion=$(PackageVersionSqlServer) + - - - + + Project + + -p:ReferenceType=Package + - - - $(CommonProperties) + + + + -p:SigningKeyPath="$(SigningKeyPath)" + + + + 10m + + --blame-hang + --blame-hang-dump-type full + --blame-hang-timeout $(TestBlameTimeout) + + + + true + + --collect "Code coverage" + --settings "$(RepoRoot)src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/CodeCoverage.runsettings" + + + + category!=failing&category!=flaky&category!=interactive + + + --filter "$(TestFilters)" + + + -f $(TestFramework) - dotnet build -p:AbstractionsPackageVersion= + + $(RepoRoot)test_results - That results in $(AbstractionsPackageVersion) being defined as empty, - and cannot be overridden by the project. + - - $(AbstractionsProperties);AbstractionsPackageVersion=$(AbstractionsPackageVersion) - - - - - $(AbstractionsProperties);AbstractionsAssemblyFileVersion=$(AbstractionsAssemblyFileVersion) - + + -p:TestSet="$(TestSet)" - - + + + + + + + + + + + + + + + - - + + + + + + + + + + + $(RepoRoot)src/Microsoft.Data.SqlClient/ + $(RepoRoot)artifacts/Microsoft.Data.SqlClient/ + + + $(SqlClientSrcRoot)src/Microsoft.Data.SqlClient.csproj + $(SqlClientSrcRoot)ref/Microsoft.Data.SqlClient.csproj + $(SqlClientSrcRoot)notsupported/Microsoft.Data.SqlClient.csproj + + + $(SqlClientSrcRoot)tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj + $(SqlClientSrcRoot)tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj + $(SqlClientSrcRoot)tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj + + + $(RepoRoot)tools/specs/Microsoft.Data.SqlClient.nuspec + $(RepoRoot)tools/GenAPI/Microsoft.DotNet.GenAPI/ + $(GenApiPath)Microsoft.DotNet.GenAPI.csproj + + + + + + + + + + + "$(DotnetPath)dotnet" build "$(GenApiProjectPath)" + -p:Configuration=$(Configuration) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + + + + + + + + + + "$(DotnetPath)dotnet" build "$(SqlClientNotSupportedProjectPath)" + -p:Configuration=$(Configuration) + -p:GenApiPath="@(GenApiArtifactPath->'%(FullPath)')" + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionSqlClientArgument) + + + $(ReferenceTypeArgument) + $(PackageVersionAbstractionsArgument) + $(PackageVersionLoggingArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + - - + + + + + "$(DotnetPath)dotnet" build $(SqlClientRefProjectPath) + -p:Configuration=$(Configuration) + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionSqlClientArgument) + + + $(ReferenceTypeArgument) + $(PackageVersionAbstractionsArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + - - - $(CommonProperties) + + + + + "$(DotnetPath)dotnet" build $(SqlClientProjectPath) + -p:Configuration=$(Configuration) + -p:TargetOs=Unix + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionSqlClientArgument) + + + $(ReferenceTypeArgument) + $(PackageVersionAbstractionsArgument) + $(PackageVersionLoggingArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + + - - - $(LoggingProperties);LoggingPackageVersion=$(LoggingPackageVersion) - - - - - $(LoggingProperties);LoggingAssemblyFileVersion=$(LoggingAssemblyFileVersion) - - + + + + + "$(DotnetPath)dotnet" build $(SqlClientProjectPath) + -p:Configuration=$(Configuration) + -p:TargetOs=Windows_NT + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionSqlClientArgument) + + + $(ReferenceTypeArgument) + $(PackageVersionAbstractionsArgument) + $(PackageVersionLoggingArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + - - + + + + + + git rev-parse HEAD + + + $([System.Text.RegularExpressions.Regex]::Replace($(GitCommand), "\s+", " ")) + + + + + + + + + + "$(DotnetPath)dotnet" msbuild "$(SqlClientProjectPath)" + -nologo + -verbosity:quiet + -getProperty:SqlClientPackageVersion + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionSqlClientArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(GetSqlClientPackageVersionCommand), "\s+", " ")) + + + + + + + + + <_EvaluatedSqlClientPackageVersion>$([System.Text.RegularExpressions.Regex]::Replace($(_EvaluatedSqlClientPackageVersion), "\s", "")) + $([System.Text.RegularExpressions.Regex]::Replace($(CommitId), "\s", "")) + + "$(NugetPath)" pack "$(SqlClientNuspecPath)" + -Symbols + -SymbolPackageFormat snupkg + -Version "$(_EvaluatedSqlClientPackageVersion)" + -OutputDirectory "$(SqlClientArtifactRoot)/$(ReferenceType)-$(Configuration)" + -properties "COMMITID=$(CommitId);Configuration=$(Configuration);ReferenceType=$(ReferenceType);AbstractionsPackageVersion=$(PackageVersionAbstractions);LoggingPackageVersion=$(PackageVersionLogging)" + + + $([System.Text.RegularExpressions.Regex]::Replace($(NuGetCommand), "\s+", " ")) + + + - - + + + + + + + + + SqlClientFunctional-$(OS) + $(LogFilePrefix)-$(TestFramework) + + + "$(DotnetPath)dotnet" test "$(SqlClientFunctionalTestProjectPath)" + -p:Configuration=$(Configuration) + $(TestBlameArgument) + $(TestCodeCoverageArgument) + $(TestFiltersArgument) + $(TestFrameworkArgument) + --results-directory "$(TestResultsFolderPath)" + --logger:"trx;LogFilePrefix=$(LogFilePrefix)" + + + $(ReferenceTypeArgument) + $(PackageVersionAbstractionsArgument) + $(PackageVersionLoggingArgument) + $(PackageVersionSqlClientArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + - - + + + + SqlClientManual-$(OS) + $(LogFilePrefix)-$(TestFramework) + $(LogFilePrefix)-$(TestSet) + + + "$(DotnetPath)dotnet" test "$(SqlClientManualTestProjectPath)" + -p:Configuration=$(Configuration) + $(TestBlameArgument) + $(TestCodeCoverageArgument) + $(TestFiltersArgument) + $(TestFrameworkArgument) + $(TestSetArgument) + --results-directory "$(TestResultsFolderPath)" + --logger:"trx;LogFilePrefix=$(LogFilePrefix)" + + + $(ReferenceTypeArgument) + $(PackageVersionAbstractionsArgument) + $(PackageVersionLoggingArgument) + $(PackageVersionSqlClientArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + - + + + + + SqlClientUnit-$(OS) + $(LogFilePrefix)-$(TestFramework) + + + "$(DotnetPath)dotnet" test "$(SqlClientUnitTestProjectPath)" + -p:Configuration=$(Configuration) + $(TestBlameArgument) + $(TestCodeCoverageArgument) + $(TestFiltersArgument) + $(TestFrameworkArgument) + --results-directory "$(TestResultsFolderPath)" + --logger:"trx;LogFilePrefix=$(LogFilePrefix)" + + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + + + + - $(CommonProperties) + $(RepoRoot)src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/ + $(AkvProviderSrcRoot)src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj + - + + + + "$(DotnetPath)dotnet" build "$(AkvProviderProjectPath)" + -p:Configuration=$(Configuration) + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionAkvProviderArgument) + + + $(ReferenceTypeArgument) + $(PackageVersionAbstractionsArgument) + $(PackageVersionLoggingArgument) + $(PackageVersionSqlClientArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + + - dotnet build -p:AzurePackageVersion= + + + + + "$(DotnetPath)dotnet" pack "$(AkvProviderProjectpath)" + -p:Configuration=$(Configuration) + $(PackBuildArgument) + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionAkvProviderArgument) + + + $(ReferenceTypeArgument) + $(PackageVersionAbstractionsArgument) + $(PackageVersionLoggingArgument) + $(PackageVersionSqlClientArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + + - That results in $(AzurePackageVersion) being defined as empty, and cannot - be overridden by the project. - --> - - $(AzureProperties);AzurePackageVersion=$(AzurePackageVersion) - - - - - $(AzureProperties);AzureAssemblyFileVersion=$(AzureAssemblyFileVersion) - + + + + $(RepoRoot)src/Microsoft.Data.SqlClient.Extensions/Abstractions/ + $(AbstractionsSrcRoot)src/Abstractions.csproj + $(AbstractionsSrcRoot)test/Abstractions.Test.csproj - - + + + + + "$(DotnetPath)dotnet" build "$(AbstractionsProjectPath)" + -p:Configuration=$(Configuration) + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionAbstractionsArgument) + + + $(ReferenceTypeArgument) + $(PackageVersionLoggingArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + - - + + + + + "$(DotnetPath)dotnet" pack "$(AbstractionsProjectPath)" + -p:Configuration=$(Configuration) + $(PackBuildArgument) + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionAbstractionsArgument) + + + $(ReferenceTypeArgument) + $(PackageVersionLoggingArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + + + + + + + + AbstractionsTests-$(OS) + $(LogFilePrefix)-$(TestFramework) + + + "$(DotnetPath)dotnet" test "$(AbstractionsTestProjectPath)" + -p:Configuration=$(Configuration) + $(TestBlameArgument) + $(TestCodeCoverageArgument) + $(TestFiltersArgument) + $(TestFrameworkArgument) + --results-directory "$(TestResultsFolderPath)" + --logger:"trx;LogFilePrefix=$(LogFilePrefix)" + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + + + + + + + $(RepoRoot)src/Microsoft.Data.SqlClient.Extensions/Azure/ + $(AzureSrcRoot)src/Azure.csproj + $(AzureSrcRoot)test/Azure.Test.csproj + + + + + + + "$(DotnetPath)dotnet" build "$(AzureProjectPath)" + -p:Configuration=$(Configuration) + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionAzureArgument) + + + $(ReferenceTypeArgument) + $(PackageVersionLoggingArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + + - + + + "$(DotnetPath)dotnet" pack "$(AzureProjectPath)" + -p:Configuration=$(Configuration) + $(PackBuildArgument) + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionAzureArgument) + + + $(ReferenceTypeArgument) + $(PackageVersionLoggingArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + - - - - - - - - - - - - - - + + + + AzureTests-$(OS) + $(LogFilePrefix)-$(TestFramework) + + + "$(DotnetPath)dotnet" test "$(AzureTestProjectPath)" + -p:Configuration=$(Configuration) + $(TestBlameArgument) + $(TestCodeCoverageArgument) + $(TestFiltersArgument) + $(TestFrameworkArgument) + --results-directory "$(TestResultsFolderPath)" + --logger:"trx;LogFilePrefix=$(LogFilePrefix)" + + + $(ReferenceTypeArgument) + + $(PackageVersionSqlClientArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + - + + - $(CommonProperties) - - - $(AkvProviderProperties);AkvPackageVersion=$(AkvPackageVersion) - - - - $(AkvProviderProperties);AkvAssemblyFileVersion=$(AkvAssemblyFileVersion) - - - - $(AkvProviderProperties);MdsPackageVersion=$(MdsPackageVersion) - - - - $(AkvProviderProperties);LoggingPackageVersion=$(LoggingPackageVersion) - - - - $(AkvProviderProperties);AbstractionsPackageVersion=$(AbstractionsPackageVersion) - + $(RepoRoot)src/Microsoft.Data.SqlClient.Internal/Logging/src/ + $(LoggingSrcRoot)Logging.csproj - - + + + + + "$(DotnetPath)dotnet" build $(LoggingProjectPath) + -p:Configuration=$(Configuration) + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionLoggingArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + - - + + + + + "$(DotnetPath)dotnet" pack $(LoggingProjectPath) + -p:Configuration=$(Configuration) + $(PackBuildArgument) + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionLoggingArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + - - + + + + $(RepoRoot)src/Microsoft.SqlServer.Server/ + $(SqlServerSrcRoot)Microsoft.SqlServer.Server.csproj + + + + + + + "$(DotnetPath)dotnet" build $(SqlServerProjectPath) + -p:Configuration=$(Configuration) + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionSqlServerArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + + + + + + "$(DotnetPath)dotnet" pack $(SqlServerProjectPath) + -p:Configuration=$(Configuration) + $(PackBuildArgument) + $(SigningKeyPathArgument) + + + $(BuildNumberArgument) + $(BuildSuffixArgument) + $(PackageVersionSqlServerArgument) + + + $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) + + + + + diff --git a/build2.proj b/build2.proj deleted file mode 100644 index e2f760af75..0000000000 --- a/build2.proj +++ /dev/null @@ -1,586 +0,0 @@ - - - - - - - - - - - - - -p:BuildNumber=$(BuildNumber) - - - - - - -p:BuildSuffix=$(BuildSuffix) - - - - Debug - - - - - - nuget - - - - true - BuildMds - - - - - -p:AbstractionsPackageVersion=$(PackageVersionAbstractions) - - - - - - -p:LoggingPackageVersion=$(PackageVersionLogging) - - - - - - -p:MdsPackageVersion=$(PackageVersionMds) - - - - Project - - -p:ReferenceType=Package - - - - - - -p:SigningKeyPath="$(SigningKeyPath)" - - - - 10m - - --blame-hang - --blame-hang-dump-type full - --blame-hang-timeout $(TestBlameTimeout) - - - - true - - --collect "Code coverage" - --settings "$(RepoRoot)src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/CodeCoverage.runsettings" - - - - category!=failing&category!=flaky - - - --filter "$(TestFilters)" - - - - - -f $(TestFramework) - - - $(RepoRoot)test_results - - - - -p:TestSet="$(TestSet)" - - - - - - - $(RepoRoot)src/Microsoft.Data.SqlClient/ - $(RepoRoot)artifacts/Microsoft.Data.SqlClient/ - - - $(MdsSrcRoot)src/Microsoft.Data.SqlClient.csproj - $(MdsSrcRoot)ref/Microsoft.Data.SqlClient.csproj - $(MdsSrcRoot)notsupported/Microsoft.Data.SqlClient.csproj - - - $(MdsSrcRoot)tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj - $(MdsSrcRoot)tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj - $(MdsSrcRoot)tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj - - - $(RepoRoot)tools/specs/Microsoft.Data.SqlClient.nuspec - $(RepoRoot)tools/GenAPI/Microsoft.DotNet.GenAPI/ - $(GenApiPath)Microsoft.DotNet.GenAPI.csproj - - - - - - - - - - - "$(DotnetPath)dotnet" build "$(GenApiProjectPath)" - -p:Configuration=$(Configuration) - - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - - - - - - - "$(DotnetPath)dotnet" build "$(MdsNotSupportedProjectPath)" - -p:Configuration=$(Configuration) - -p:GenApiPath="@(GenApiArtifactPath->'%(FullPath)')" - $(SigningKeyPathArgument) - - - $(BuildNumberArgument) - $(BuildSuffixArgument) - $(PackageVersionMdsArgument) - - - $(ReferenceTypeArgument) - $(PackageVersionAbstractionsArgument) - $(PackageVersionLoggingArgument) - - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - - - - - "$(DotnetPath)dotnet" build $(MdsRefProjectPath) - -p:Configuration=$(Configuration) - $(SigningKeyPathArgument) - - - $(BuildNumberArgument) - $(BuildSuffixArgument) - $(PackageVersionMdsArgument) - - - $(ReferenceTypeArgument) - $(PackageVersionAbstractionsArgument) - - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - - - - - "$(DotnetPath)dotnet" build $(MdsProjectPath) - -p:Configuration=$(Configuration) - -p:TargetOs=Unix - $(SigningKeyPathArgument) - - - $(BuildNumberArgument) - $(BuildSuffixArgument) - $(PackageVersionMdsArgument) - - - $(ReferenceTypeArgument) - $(PackageVersionAbstractionsArgument) - $(PackageVersionLoggingArgument) - - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - - - - - "$(DotnetPath)dotnet" build $(MdsProjectPath) - -p:Configuration=$(Configuration) - -p:TargetOs=Windows_NT - $(SigningKeyPathArgument) - - - $(BuildNumberArgument) - $(BuildSuffixArgument) - $(PackageVersionMdsArgument) - - - $(ReferenceTypeArgument) - $(PackageVersionAbstractionsArgument) - $(PackageVersionLoggingArgument) - - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - - - - - - - - git rev-parse HEAD - - - $([System.Text.RegularExpressions.Regex]::Replace($(GitCommand), "\s+", " ")) - - - - - - - - - - "$(DotnetPath)dotnet" msbuild "$(MdsProjectPath)" - -nologo - -verbosity:quiet - -getProperty:MdsPackageVersion - - - $(BuildNumberArgument) - $(BuildSuffixArgument) - $(PackageVersionMdsArgument) - - - $([System.Text.RegularExpressions.Regex]::Replace($(GetMdsPackageVersionCommand), "\s+", " ")) - - - - - - - - - <_EvaluatedMdsPackageVersion>$([System.Text.RegularExpressions.Regex]::Replace($(_EvaluatedMdsPackageVersion), "\s", "")) - $([System.Text.RegularExpressions.Regex]::Replace($(CommitId), "\s", "")) - - "$(NugetPath)" pack "$(MdsNuspecPath)" - -Symbols - -SymbolPackageFormat snupkg - -Version "$(_EvaluatedMdsPackageVersion)" - -OutputDirectory "$(MdsArtifactRoot)/$(ReferenceType)-$(Configuration)" - -properties "COMMITID=$(CommitId);Configuration=$(Configuration);ReferenceType=$(ReferenceType);AbstractionsPackageVersion=$(PackageVersionAbstractions);LoggingPackageVersion=$(PackageVersionLogging)" - - - $([System.Text.RegularExpressions.Regex]::Replace($(NuGetCommand), "\s+", " ")) - - - - - - - - - - - - - - MdsFunctional-$(OS) - $(LogFilePrefix)-$(TestFramework) - - - "$(DotnetPath)dotnet" test "$(MdsFunctionalTestProjectPath)" - -p:Configuration=$(Configuration) - $(TestBlameArgument) - $(TestCodeCoverageArgument) - $(TestFiltersArgument) - $(TestFrameworkArgument) - --results-directory "$(TestResultsFolderPath)" - --logger:"trx;LogFilePrefix=$(LogFilePrefix)" - - - $(ReferenceTypeArgument) - $(PackageVersionAbstractionsArgument) - $(PackageVersionLoggingArgument) - $(PackageVersionMdsArgument) - - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - - - MdsManual-$(OS) - $(LogFilePrefix)-$(TestFramework) - $(LogFilePrefix)-$(TestSet) - - - "$(DotnetPath)dotnet" test "$(MdsManualTestProjectPath)" - -p:Configuration=$(Configuration) - $(TestBlameArgument) - $(TestCodeCoverageArgument) - $(TestFiltersArgument) - $(TestFrameworkArgument) - $(TestSetArgument) - --results-directory "$(TestResultsFolderPath)" - --logger:"trx;LogFilePrefix=$(LogFilePrefix)" - - - $(ReferenceTypeArgument) - $(PackageVersionAbstractionsArgument) - $(PackageVersionLoggingArgument) - $(PackageVersionMdsArgument) - - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - - - - MdsUnit-$(OS) - $(LogFilePrefix)-$(TestFramework) - - - "$(DotnetPath)dotnet" test "$(MdsUnitTestProjectPath)" - -p:Configuration=$(Configuration) - $(TestBlameArgument) - $(TestCodeCoverageArgument) - $(TestFiltersArgument) - $(TestFrameworkArgument) - --results-directory "$(TestResultsFolderPath)" - --logger:"trx;LogFilePrefix=$(LogFilePrefix)" - - - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - diff --git a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml index 5e17b506c1..afb20ac80e 100644 --- a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml @@ -176,20 +176,15 @@ jobs: mdsPackageVersion: ${{ parameters.mdsPackageVersion }} akvPackageVersion: ${{ parameters.akvPackageVersion }} - - task: MSBuild@1 + - task: DotNetCoreCLI@2 displayName: 'Create AKV Provider NuGet Package' inputs: - solution: build.proj - msbuildArchitecture: x64 - platform: '${{ parameters.platform }}' - configuration: '${{ parameters.buildConfiguration }}' - msbuildArguments: >- - -t:PackAkvProvider - -p:ReferenceType=${{ parameters.referenceType }} - -p:LoggingPackageVersion=${{ parameters.loggingPackageVersion }} - -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} - -p:AkvPackageVersion=${{ parameters.akvPackageVersion }} - -p:PackageOutputPath=$(packagePath) + command: pack + packagesToPack: src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj + configurationToPack: ${{ parameters.buildConfiguration }} + nobuild: true + packDirectory: $(packagePath) + buildProperties: ReferenceType=${{ parameters.referenceType }};AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }};LoggingPackageVersion=${{ parameters.loggingPackageVersion }};SqlClientPackageVersion=${{ parameters.mdsPackageVersion }};AkvProviderPackageVersion=${{ parameters.akvPackageVersion }};BuildNumber=$(Build.BuildNumber);AssemblyBuildNumber=$(assemblyBuildNumber) - task: PublishPipelineArtifact@1 displayName: 'Publish Pipeline Artifacts' diff --git a/eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml b/eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml index 8c1d665e60..2fe5cb5fe8 100644 --- a/eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml +++ b/eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml @@ -49,7 +49,7 @@ steps: -p:ReferenceType=Package -p:Configuration=Release -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:SqlClientPackageVersion=${{ parameters.mdsPackageVersion }} --no-build -v n --filter "category!=failing&category!=flaky&category!=interactive" @@ -70,7 +70,7 @@ steps: -p:ReferenceType=Package -p:Configuration=Release -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:SqlClientPackageVersion=${{ parameters.mdsPackageVersion }} --no-build -v n --filter "category=flaky" @@ -92,7 +92,7 @@ steps: -p:ReferenceType=Package -p:Configuration=Release -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:SqlClientPackageVersion=${{ parameters.mdsPackageVersion }} --no-build -v n --filter "category!=failing&category!=flaky&category!=interactive" @@ -114,7 +114,7 @@ steps: -p:ReferenceType=Package -p:Configuration=Release -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:SqlClientPackageVersion=${{ parameters.mdsPackageVersion }} --no-build -v n --filter "category=flaky" diff --git a/eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml b/eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml index c13256c614..2783094ce7 100644 --- a/eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml +++ b/eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml @@ -49,7 +49,7 @@ steps: -p:ReferenceType=Package -p:Configuration=Release -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:SqlClientPackageVersion=${{ parameters.mdsPackageVersion }} --no-build -v n --filter "category!=failing&category!=flaky&category!=interactive" @@ -70,7 +70,7 @@ steps: -p:ReferenceType=Package -p:Configuration=Release -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:SqlClientPackageVersion=${{ parameters.mdsPackageVersion }} --no-build -v n --filter "category=flaky" @@ -92,7 +92,7 @@ steps: -p:ReferenceType=Package -p:Configuration=Release -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:SqlClientPackageVersion=${{ parameters.mdsPackageVersion }} --no-build -v n --filter "category!=failing&category!=flaky&category!=interactive" @@ -114,7 +114,7 @@ steps: -p:ReferenceType=Package -p:Configuration=Release -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:SqlClientPackageVersion=${{ parameters.mdsPackageVersion }} --no-build -v n --filter "category=flaky" diff --git a/eng/pipelines/common/templates/steps/ci-project-build-step.yml b/eng/pipelines/common/templates/steps/ci-project-build-step.yml index d2604e0b3d..bbd2d10744 100644 --- a/eng/pipelines/common/templates/steps/ci-project-build-step.yml +++ b/eng/pipelines/common/templates/steps/ci-project-build-step.yml @@ -79,40 +79,33 @@ steps: displayName: 'Build Driver' condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) inputs: - solution: build2.proj + solution: build.proj msbuildArchitecture: x64 platform: '${{ parameters.platform }}' configuration: '${{ parameters.buildConfiguration }}' msbuildArguments: - -t:BuildMds + -t:BuildSqlClient -p:ReferenceType=${{ parameters.referenceType }} -p:BuildNumber=${{ parameters.assemblyBuildNumber }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} # Build AKV Provider - ${{ if or(eq(parameters.build, 'AkvProvider'), eq(parameters.build, 'all'), eq(parameters.build, 'allNoDocs')) }}: - - task: MSBuild@1 + - task: DotNetCoreCLI@2 displayName: 'Build AKV Provider' condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) inputs: - solution: build.proj - msbuildArchitecture: x64 - platform: '${{ parameters.platform }}' - configuration: '${{ parameters.buildConfiguration }}' - msbuildArguments: >- - -t:BuildAkvProvider + command: build + projects: src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj + arguments: >- + --configuration ${{ parameters.buildConfiguration }} -p:ReferenceType=${{ parameters.referenceType }} - -p:TestEnabled=true - -p:GenerateNuget=false - -p:Configuration=${{ parameters.buildConfiguration }} -p:BuildNumber=${{ parameters.buildNumber }} -p:AssemblyBuildNumber=${{ parameters.assemblyBuildNumber }} - -p:AkvPackageVersion=${{ parameters.akvPackageVersion }} + -p:AkvProviderPackageVersion=${{ parameters.akvPackageVersion }} -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} -p:LoggingPackageVersion=${{ parameters.loggingPackageVersion }} - -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} - verbosityRestore: Detailed - verbosityPack: Detailed + -p:SqlClientPackageVersion=${{ parameters.mdsPackageVersion }} diff --git a/eng/pipelines/common/templates/steps/run-all-tests-step.yml b/eng/pipelines/common/templates/steps/run-all-tests-step.yml index 68689adf44..e3397e45f0 100644 --- a/eng/pipelines/common/templates/steps/run-all-tests-step.yml +++ b/eng/pipelines/common/templates/steps/run-all-tests-step.yml @@ -81,19 +81,19 @@ steps: displayName: 'Run Unit Tests ${{parameters.msbuildArchitecture }}' condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) inputs: - solution: build2.proj + solution: build.proj msbuildArchitecture: ${{parameters.msbuildArchitecture }} platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: msbuildArguments: >- - -t:TestMdsUnit + -t:TestSqlClientUnit -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:TestResultsFolderPath=TestResults ${{ else }}: # x86 msbuildArguments: >- - -t:TestMdsUnit + -t:TestSqlClientUnit -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:DotnetPath=${{ parameters.dotnetx86RootPath }} @@ -103,13 +103,13 @@ steps: displayName: 'Run Flaky Unit Tests ${{parameters.msbuildArchitecture }}' condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) inputs: - solution: build2.proj + solution: build.proj msbuildArchitecture: ${{parameters.msbuildArchitecture }} platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: msbuildArguments: >- - -t:TestMdsUnit + -t:TestSqlClientUnit -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:TestFilters="category=flaky" @@ -117,7 +117,7 @@ steps: -p:TestCodeCoverage=false ${{ else }}: # x86 msbuildArguments: >- - -t:TestMdsUnit + -t:TestSqlClientUnit -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:DotnetPath=${{ parameters.dotnetx86RootPath }} @@ -130,27 +130,27 @@ steps: displayName: 'Run Functional Tests ${{parameters.msbuildArchitecture }}' condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) inputs: - solution: build2.proj + solution: build.proj msbuildArchitecture: ${{parameters.msbuildArchitecture }} platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: msbuildArguments: >- - -t:TestMdsFunctional + -t:TestSqlClientFunctional -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:TestResultsFolderPath=TestResults ${{ else }}: # x86 msbuildArguments: >- - -t:TestMdsFunctional + -t:TestSqlClientFunctional -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:DotnetPath=${{ parameters.dotnetx86RootPath }} -p:TestResultsFolderPath=TestResults @@ -158,29 +158,29 @@ steps: condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) displayName: 'Run Flaky Functional Tests ${{parameters.msbuildArchitecture }}' inputs: - solution: build2.proj + solution: build.proj msbuildArchitecture: ${{parameters.msbuildArchitecture }} platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: msbuildArguments: >- - -t:TestMdsFunctional + -t:TestSqlClientFunctional -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:TestFilters="category=flaky" -p:TestResultsFolderPath=TestResults -p:TestCodeCoverage=false ${{ else }}: # x86 msbuildArguments: >- - -t:TestMdsFunctional + -t:TestSqlClientFunctional -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:DotnetPath=${{ parameters.dotnetx86RootPath }} -p:TestFilters="category=flaky" -p:TestResultsFolderPath=TestResults @@ -191,29 +191,29 @@ steps: condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) displayName: 'Run Manual Tests ${{parameters.msbuildArchitecture }}' inputs: - solution: build2.proj + solution: build.proj msbuildArchitecture: ${{parameters.msbuildArchitecture }} platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: msbuildArguments: >- - -t:TestMdsManual + -t:TestSqlClientManual -p:TestFramework=${{ parameters.targetFramework }} -p:TestSet=${{ parameters.testSet }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:TestResultsFolderPath=TestResults ${{ else }}: # x86 msbuildArguments: >- - -t:TestMdsManual + -t:TestSqlClientManual -p:TestFramework=${{ parameters.targetFramework }} -p:TestSet=${{ parameters.testSet }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:DotnetPath=${{ parameters.dotnetx86RootPath }} -p:TestResultsFolderPath=TestResults retryCountOnTaskFailure: ${{parameters.retryCountOnManualTests }} @@ -222,31 +222,31 @@ steps: condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) displayName: 'Run Flaky Manual Tests ${{parameters.msbuildArchitecture }}' inputs: - solution: build2.proj + solution: build.proj msbuildArchitecture: ${{parameters.msbuildArchitecture }} platform: '${{parameters.platform }}' configuration: '${{parameters.buildConfiguration }}' ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: msbuildArguments: >- - -t:TestMdsManual + -t:TestSqlClientManual -p:TestFramework=${{ parameters.targetFramework }} -p:TestSet=${{ parameters.testSet }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:TestFilters="category=flaky" -p:TestResultsFolderPath=TestResults -p:TestCodeCoverage=false ${{ else }}: # x86 msbuildArguments: >- - -t:TestMdsManual + -t:TestSqlClientManual -p:TestFramework=${{ parameters.targetFramework }} -p:TestSet=${{ parameters.testSet }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:DotnetPath=${{ parameters.dotnetx86RootPath }} -p:TestFilters="category=flaky" -p:TestResultsFolderPath=TestResults @@ -260,15 +260,15 @@ steps: condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) inputs: command: custom - projects: build2.proj + projects: build.proj custom: msbuild arguments: >- - -t:TestMdsUnit + -t:TestSqlClientUnit -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:Configuration=${{ parameters.buildConfiguration }} -p:TestResultsFolderPath=TestResults verbosityRestore: Detailed @@ -279,15 +279,15 @@ steps: condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) inputs: command: custom - projects: build2.proj + projects: build.proj custom: msbuild arguments: >- - -t:TestMdsUnit + -t:TestSqlClientUnit -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:Configuration=${{ parameters.buildConfiguration }} -p:TestFilters="category=flaky" -p:TestResultsFolderPath=TestResults @@ -301,15 +301,15 @@ steps: condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) inputs: command: custom - projects: build2.proj + projects: build.proj custom: msbuild arguments: >- - -t:TestMdsFunctional + -t:TestSqlClientFunctional -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:Configuration=${{ parameters.buildConfiguration }} -p:TestResultsFolderPath=TestResults verbosityRestore: Detailed @@ -320,15 +320,15 @@ steps: displayName: 'Run Flaky Functional Tests' inputs: command: custom - projects: build2.proj + projects: build.proj custom: msbuild arguments: >- - -t:TestMdsFunctional + -t:TestSqlClientFunctional -p:TestFramework=${{ parameters.targetFramework }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:Configuration=${{ parameters.buildConfiguration }} -p:TestFilters="category=flaky" -p:TestResultsFolderPath=TestResults @@ -336,22 +336,21 @@ steps: verbosityRestore: Detailed verbosityPack: Detailed continueOnError: true - - task: DotNetCoreCLI@2 displayName: 'Run Manual Tests' condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) inputs: command: custom - projects: build2.proj + projects: build.proj custom: msbuild arguments: >- - -t:TestMdsManual + -t:TestSqlClientManual -p:TestFramework=${{ parameters.targetFramework }} -p:TestSet=${{ parameters.testSet }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:Configuration=${{ parameters.buildConfiguration }} -p:TestResultsFolderPath=TestResults verbosityRestore: Detailed @@ -363,16 +362,16 @@ steps: condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) inputs: command: custom - projects: build2.proj + projects: build.proj custom: msbuild arguments: >- - -t:TestMdsManual + -t:TestSqlClientManual -p:TestFramework=${{ parameters.targetFramework }} -p:TestSet=${{ parameters.testSet }} -p:ReferenceType=${{ parameters.referenceType }} -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.mdsPackageVersion }} + -p:PackageVersionSqlClient=${{ parameters.mdsPackageVersion }} -p:Configuration=${{ parameters.buildConfiguration }} -p:TestFilters="category=flaky" -p:TestResultsFolderPath=TestResults @@ -380,3 +379,4 @@ steps: verbosityRestore: Detailed verbosityPack: Detailed continueOnError: true + diff --git a/eng/pipelines/dotnet-sqlclient-ci-core.yml b/eng/pipelines/dotnet-sqlclient-ci-core.yml index d39c590efc..c8181aff5a 100644 --- a/eng/pipelines/dotnet-sqlclient-ci-core.yml +++ b/eng/pipelines/dotnet-sqlclient-ci-core.yml @@ -119,12 +119,26 @@ variables: - name: mdsArtifactsName value: MDS.Artifacts + - name: sqlServerArtifactsName + value: SqlServer.Artifacts + stages: # Generate secrets used throughout the pipeline. - template: /eng/pipelines/stages/generate-secrets-ci-stage.yml@self parameters: debug: ${{ parameters.debug }} + # Build the SqlServer package, and publish it to the pipeline artifacts + # under the given artifact name. This runs in parallel with the Secrets + # generation stage since it has no package dependencies. + - template: /eng/pipelines/stages/build-sqlserver-package-ci-stage.yml@self + parameters: + sqlServerArtifactsName: $(sqlServerArtifactsName) + sqlServerPackageVersion: $(sqlServerPackageVersion) + buildConfiguration: ${{ parameters.buildConfiguration }} + debug: ${{ parameters.debug }} + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} + # Build the Logging package, and publish it to the pipeline artifacts # under the given artifact name. This runs in parallel with the Secrets # generation stage since it has no package dependencies. @@ -212,6 +226,7 @@ stages: azureArtifactsName: $(azureArtifactsName) loggingArtifactsName: $(loggingArtifactsName) mdsArtifactsName: $(mdsArtifactsName) + sqlServerArtifactsName: $(sqlServerArtifactsName) # Run the MDS and AKV tests. - template: /eng/pipelines/common/templates/stages/ci-run-tests-stage.yml@self diff --git a/eng/pipelines/jobs/pack-sqlserver-package-ci-job.yml b/eng/pipelines/jobs/pack-sqlserver-package-ci-job.yml new file mode 100644 index 0000000000..915bf1e9bd --- /dev/null +++ b/eng/pipelines/jobs/pack-sqlserver-package-ci-job.yml @@ -0,0 +1,113 @@ +################################################################################ +# Licensed to the .NET Foundation under one or more agreements. The .NET +# Foundation licenses this file to you under the MIT license. See the LICENSE +# file in the project root for more information. +################################################################################ + +# This job packs the Microsoft.SqlServer.Server package into NuGet and symbols +# packages and publishes them as a named pipeline artifact. +# +# This template defines a job named 'pack_sqlserver_package_job' that can be +# depended on by downstream jobs. + +parameters: + + # The type of build to produce (Release or Debug) + - name: buildConfiguration + type: string + values: + - Release + - Debug + + # True to emit debug information and steps. + - name: debug + type: boolean + default: false + + # The name of the pipeline artifacts to publish. + - name: sqlServerArtifactsName + type: string + default: SqlServer.Artifacts + + # The version to apply to the SqlServer NuGet package and its assemblies. + - name: sqlServerPackageVersion + type: string + + # The list of upstream jobs to depend on. + - name: dependsOn + type: object + default: [] + + # The verbosity level for the dotnet CLI commands. + - name: dotnetVerbosity + type: string + default: normal + values: + - quiet + - minimal + - normal + - detailed + - diagnostic + +jobs: + + - job: pack_sqlserver_package_job + displayName: Pack SqlServer Package + + dependsOn: ${{ parameters.dependsOn }} + + pool: + name: Azure Pipelines + vmImage: ubuntu-latest + + variables: + + # The SqlServer project file to use for all dotnet CLI commands. + - name: project + value: src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj + + # The directory where the NuGet packages will be staged before being + # published as pipeline artifacts. + - name: dotnetPackagesDir + value: $(Build.StagingDirectory)/dotnetPackages + + # Explicitly unset the $PLATFORM environment variable that is set by the + # 'ADO Build properties' Library in the ADO SqlClientDrivers public project. + - name: Platform + value: '' + + # Do the same for $CONFIGURATION since we explicitly set it using our + # 'buildConfiguration' parameter, and we don't want the environment to + # override us. + - name: Configuration + value: '' + + steps: + + # Emit environment variables if debug is enabled. + - ${{ if eq(parameters.debug, true) }}: + - pwsh: 'Get-ChildItem Env: | Sort-Object Name' + displayName: '[Debug] Print Environment Variables' + + # Install the .NET SDK. + - template: /eng/pipelines/steps/install-dotnet.yml@self + parameters: + debug: ${{ parameters.debug }} + + # Create the NuGet packages. + - task: DotNetCoreCLI@2 + displayName: Create NuGet Package + inputs: + command: pack + packagesToPack: $(project) + configurationToPack: ${{ parameters.buildConfiguration }} + packDirectory: $(dotnetPackagesDir) + verbosityToPack: ${{ parameters.dotnetVerbosity }} + buildProperties: SqlServerPackageVersion=${{ parameters.sqlServerPackageVersion }} + + - task: PublishPipelineArtifact@1 + displayName: Publish Pipeline Artifact + inputs: + targetPath: $(dotnetPackagesDir) + artifactName: ${{ parameters.sqlServerArtifactsName }} + publishLocation: pipeline diff --git a/eng/pipelines/jobs/test-azure-package-ci-job.yml b/eng/pipelines/jobs/test-azure-package-ci-job.yml index 5e5dffe381..0ad4246cb0 100644 --- a/eng/pipelines/jobs/test-azure-package-ci-job.yml +++ b/eng/pipelines/jobs/test-azure-package-ci-job.yml @@ -153,7 +153,7 @@ jobs: --verbosity ${{ parameters.dotnetVerbosity }} -p:ReferenceType=${{ parameters.referenceType }} -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} + -p:SqlClientPackageVersion=${{ parameters.mdsPackageVersion }} # Explicitly unset the $PLATFORM environment variable that is set by the # 'ADO Build properties' Library in the ADO SqlClientDrivers public diff --git a/eng/pipelines/libraries/ci-build-variables.yml b/eng/pipelines/libraries/ci-build-variables.yml index 027501df0f..6d39d085b7 100644 --- a/eng/pipelines/libraries/ci-build-variables.yml +++ b/eng/pipelines/libraries/ci-build-variables.yml @@ -28,7 +28,7 @@ variables: # Abstractions library NuGet package version - name: abstractionsPackageVersion - value: 1.0.0.$(Build.BuildNumber)-ci + value: 1.0.0-ci$(Build.BuildNumber) # AKV provider assembly file version - name: akvAssemblyFileVersion @@ -36,7 +36,7 @@ variables: # AKV provider NuGet package version - name: akvPackageVersion - value: 7.0.0.$(Build.BuildNumber)-ci + value: 7.0.0-ci$(Build.BuildNumber) # Azure library assembly file version - name: azureAssemblyFileVersion @@ -44,7 +44,7 @@ variables: # Azure library NuGet package version - name: azurePackageVersion - value: 1.0.0.$(Build.BuildNumber)-ci + value: 1.0.0-ci$(Build.BuildNumber) # Logging library assembly file version - name: loggingAssemblyFileVersion @@ -52,16 +52,22 @@ variables: # Logging library NuGet package version - name: loggingPackageVersion - value: 1.0.0.$(Build.BuildNumber)-ci + value: 1.0.0-ci$(Build.BuildNumber) # MDS library NuGet package version # NOTE: This differs from the other structures! MdsVersions.props will deconstruct a provided # package version and build an assembly version from it. If the build number is included # before the "-" the build number will be appended again, generating an invalid file version. - # @TODO: This is a band-aid to ensure that CI builds until we can centralize versioning. - name: mdsPackageVersion value: 7.0.0-ci$(AssemblyBuildNumber) + # SqlServer library NuGet package version + # NOTE: SqlServer's version props derive file version from the package version by appending the + # assembly build number, so this must remain a three-part SemVer base with a prerelease + # suffix, not a four-part numeric version. + - name: sqlServerPackageVersion + value: 1.0.0-ci$(AssemblyBuildNumber) + # Local NuGet feed directory where downloaded pipeline artifacts are placed. # NuGet.config references this as a local package source for restore. - name: localFeedPath diff --git a/eng/pipelines/onebranch/jobs/build-buildproj-job.yml b/eng/pipelines/onebranch/jobs/build-buildproj-job.yml new file mode 100644 index 0000000000..c700a57701 --- /dev/null +++ b/eng/pipelines/onebranch/jobs/build-buildproj-job.yml @@ -0,0 +1,212 @@ +################################################################################# +# Licensed to the .NET Foundation under one or more agreements. # +# The .NET Foundation licenses this file to you under the MIT license. # +# See the LICENSE file in the project root for more information. # +################################################################################# + +# Generic job template for building and signing simple build.proj packages. +# +# The job builds DLLs via build.proj, ESRP signs the DLLs, creates NuGet packages from the signed +# DLLs, ESRP signs the NuGet packages, and finally copies all the build output to the job output. + +parameters: + # Common Build Job Properties ############################################ + - name: apiScanDllPath + type: string + + - name: apiScanPdbPath + type: string + + # True to enable ESRP malware scanning and code signing steps, which should not be run on + # non-official pipelines as they access production resources. If true, Signing* parameters must + # be provided. + - name: shouldSignPackage + type: boolean + + # Signing Parameters ----------------------------------------------------- + # @TODO: Signing Parameters Object + + - name: signingAppRegistrationClientId + type: string + + - name: signingAppRegistrationTenantId + type: string + + - name: signingAuthAkvName + type: string + + - name: signingAuthSignCertName + type: string + + - name: signingEsrpClientId + type: string + + - name: signingEsrpConnectedServiceName + type: string + + # Package Properties ##################################################### + + # A list of packages that the package being built with this job depends on. Each entry in the + # object should have the fields: + # * artifactName - Name of the artifact published in a previous job that contains the desired + # version of the dependency. + # * shortName - Short name of the dependency. This name should correspond to the short name used + # when building the package via build.proj + # * version - the version of the dependency that this package depends on + - name: dependencies + type: object + default: [] + + # Assembly file version for APIScan (e.g. 1.0.0.12345). + - name: fileVersion + type: string + + # The full name of the package. This is used in the job name, and to form DLL and PDB filenames + # for APIScan. + - name: packageFullName + type: string + values: + - 'Microsoft.Data.SqlClient' + - 'Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider' + - 'Microsoft.Data.SqlClient.Extensions.Abstractions' + - 'Microsoft.Data.SqlClient.Extensions.Azure' + - 'Microsoft.Data.SqlClient.Internal.Logging' + - 'Microsoft.SqlServer.Server' + + # Short package name used in the job name, display strings, filesystem paths, and as a suffix for + # the default Build and Pack targets if those aren't specified. + - name: packageShortName + type: string + values: + - 'Abstractions' + - 'AkvProvider' + - 'Azure' + - 'Logging' + - 'SqlClient' + - 'SqlServer' + + # The version of the package. + - name: packageVersion + type: string + +jobs: + - job: 'build_package_${{ parameters.packageShortName }}' + displayName: 'Build: ${{ parameters.packageFullName }}' + pool: + type: windows + + variables: + # Placeholder for dependency package arguments. This will be constructed later as it depends + # on scripting to decompose parameters.dependencies. + dependencyPackageArguments: '' + + ob_outputDirectory: '$(JOB_OUTPUT)' + + # APIScan configuration for the package being built by this job. + ob_sdl_apiscan_enabled: true + ob_sdl_apiscan_softwareFolder: ${{ parameters.apiScanDllPath }} + ob_sdl_apiscan_symbolsFolder: ${{ parameters.apiScanPdbPath }} + ob_sdl_apiscan_softwarename: ${{ parameters.packageFullName }} + ob_sdl_apiscan_versionNumber: ${{ parameters.fileVersion }} + + steps: + - template: /eng/pipelines/onebranch/steps/script-output-environment-variables-step.yml@self + + # Constructs the dependency package version parameters to pass to the build steps. Generates + # a string of the form (eg) "-p:PackageVersionAzure=1.2.3" + - ${{ each package in parameters.dependencies }}: + # Append the dependency to the package dependency arguments argument in the form of, eg: + # -p:PackageVersionAzure=1.2.3 + - script: echo "##vso[task.setvariable variable=dependencyPackageArguments]$(dependencyPackageArguments) -p:PackageVersion${{ package.shortName }}=${{ package.version }} + displayName: "Append Package Version Argument - ${{ package.shortName }}" + + # Download the pipeline artifact for this dependency package + - task: DownloadPipelineArtifact@2 + displayName: "Download Artifact - ${{ package.shortName }}" + inputs: + artifactName: ${{ package.artifactName }} + targetPath: $(REPO_ROOT)/packages + + # Install the .NET SDK. + - template: /eng/pipelines/steps/install-dotnet.yml@self + + # Perform Roslyn analysis before building, since this step will clobber build output. + - template: /eng/pipelines/onebranch/steps/roslyn-analyzers-buildproj-step.yml@self + parameters: + dependencyArguments: $(dependencyPackageArguments) + packageShortName: ${{ parameters.packageShortName }} + packageVersion: ${{ parameters.packageVersion }} + + # Build the package, producing DLLs only (no NuGet package yet). + - template: /eng/pipelines/onebranch/steps/build-buildproj-step.yml@self + parameters: + buildConfiguration: Release + dependencyArguments: $(dependencyPackageArguments) + packageShortName: ${{ parameters.packageShortName }} + packageVersion: ${{ parameters.packageVersion }} + + - ${{ if eq(parameters.shouldSignPackage, true) }}: + # ESRP sign the DLLs. + - template: /eng/pipelines/onebranch/steps/esrp-dll-signing-step.yml@self + parameters: + appRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' + appRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' + authAkvName: '${{ parameters.signingAuthAkvName }}' + authSignCertName: '${{ parameters.signingAuthSignCertName }}' + esrpClientId: '${{ parameters.signingEsrpClientId }}' + esrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' + pattern: '${{ parameters.packageFullName }}.dll' + + # Copy signed/unsigned DLLs and PDBs to APIScan folders. + - task: CopyFiles@2 + displayName: Copy DLLs for APIScan + inputs: + SourceFolder: $(BUILD_OUTPUT)/${{ parameters.packageFullName }} + Contents: "**/${{ parameters.packageFullName }}.dll" + TargetFolder: '${{ parameters.apiScanDllPath }}' + # We must preserve the folder structure since our C# projects may produce multiple + # identically named DLLs for different target frameworks (e.g. netstandard2.0, net5.0, + # etc.), and we need to keep those separate for APIScan to work correctly. + flattenFolders: false + + - task: CopyFiles@2 + displayName: Copy PDBs for APIScan + inputs: + SourceFolder: $(BUILD_OUTPUT)/${{ parameters.packageFullName }} + Contents: "**/${{ parameters.packageFullName }}.pdb" + TargetFolder: '${{ parameters.apiScanPdbPath }}' + # We must preserve the folder structure since our C# projects may produce multiple + # identically named DLLs for different target frameworks (e.g. netstandard2.0, net5.0, + # etc.), and we need to keep those separate for APIScan to work correctly. + flattenFolders: false + + # Pack the signed DLLs into NuGet package (NoBuild=true). + - template: /eng/pipelines/onebranch/steps/pack-buildproj-step.yml@self + parameters: + buildConfiguration: Release + dependencyArguments: $(dependencyPackageArguments) + packageFullName: ${{ parameters.packageFullName }} + packageShortName: ${{ parameters.packageShortName }} + packageVersion: ${{ parameters.packageVersion }} + + - ${{ if eq(parameters.shouldSignPackage, true) }}: + # ESRP sign the NuGet package. + - template: /eng/pipelines/onebranch/steps/esrp-nuget-signing-step.yml@self + parameters: + appRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' + appRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' + authAkvName: '${{ parameters.signingAuthAkvName }}' + authSignCertName: '${{ parameters.signingAuthSignCertName }}' + esrpClientId: '${{ parameters.signingEsrpClientId }}' + esrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' + searchPath: '$(PACK_OUTPUT)' + searchPattern: '${{ parameters.packageFullName}}.*nupkg' + + # Copy the contents of the build output for this package to the artifacts folder + - task: CopyFiles@2 + displayName: Copy Build Output to Artifacts Folder + inputs: + SourceFolder: '$(BUILD_OUTPUT)/${{ parameters.packageFullName }}' + Contents: '**/*.*' + TargetFolder: '$(JOB_OUTPUT)' + flattenFolders: false diff --git a/eng/pipelines/onebranch/jobs/build-signed-csproj-package-job.yml b/eng/pipelines/onebranch/jobs/build-signed-csproj-package-job.yml deleted file mode 100644 index 94e6438ef5..0000000000 --- a/eng/pipelines/onebranch/jobs/build-signed-csproj-package-job.yml +++ /dev/null @@ -1,216 +0,0 @@ -################################################################################# -# Licensed to the .NET Foundation under one or more agreements. # -# The .NET Foundation licenses this file to you under the MIT license. # -# See the LICENSE file in the project root for more information. # -################################################################################# - -# Generic job template for building and signing simple csproj-based packages, currently: -# -# - Abstractions -# - Azure -# - Logging -# - SqlServer -# -# The job builds DLLs via build.proj, ESRP signs the DLLs, then creates NuGet packages from the -# signed DLLs, and finally ESRP signs the NuGet packages. - -parameters: - - # Signing Parameters ----------------------------------------------------- - - - name: signingAppRegistrationClientId - type: string - - - name: signingAppRegistrationTenantId - type: string - - - name: signingAuthAkvName - type: string - - - name: signingAuthSignCertName - type: string - - - name: signingEsrpClientId - type: string - - - name: signingEsrpConnectedServiceName - type: string - - # OTHERS +===================================== - - # Short package name used in the job name, display strings, filesystem paths, and as a suffix for - # the default Build and Pack targets if those aren't specified. - - name: packageName - type: string - values: - - Abstractions - - AkvProvider - - Azure - - Logging - - SqlServer - - # The full name of the package. This is used in the job name, and to form DLL and PDB filenames - # for APIScan. - - name: packageFullName - type: string - - # The MSBuild build target in build.proj (e.g. BuildLogging). If not specified, defaults to - # Build. - - name: buildTarget - type: string - default: "" - - # True to enable ESRP malware scanning and code signing steps, which should not be - # run on non-official pipelines as they access production resources. - - name: isOfficial - type: boolean - - # The MSBuild pack target in build.proj (e.g. PackLogging). If not specified, defaults to - # Pack. - - name: packTarget - type: string - default: "" - - # Additional MSBuild -p: arguments for version properties. These may include versions of - # packages this package depends on, or versions for this package itself. - - name: versionProperties - type: string - default: "" - - # Assembly file version for APIScan (e.g. 1.0.0.12345). - - name: assemblyFileVersion - type: string - - # Optional list of pipeline artifacts to download before building. Each entry is an object - # with 'artifactName' (the pipeline artifact name) and 'displayName' (used in the task label). - # This replaces hard-coded packageName conditionals so callers declare their own dependencies. - - name: downloadArtifacts - type: object - default: [] - -jobs: - - job: build_package_${{ parameters.packageName }} - displayName: Build ${{ parameters.packageFullName }} - pool: - type: windows - - variables: - # Inform OneBranch that files put in this directory should be uploaded as artifacts. - ob_outputDirectory: $(JOB_OUTPUT) - - # APIScan configuration for this Extension package - ob_sdl_apiscan_enabled: true - ob_sdl_apiscan_softwareFolder: $(JOB_OUTPUT)/assemblies - ob_sdl_apiscan_symbolsFolder: $(JOB_OUTPUT)/symbols - ob_sdl_apiscan_softwarename: ${{ parameters.packageFullName }} - ob_sdl_apiscan_versionNumber: ${{ parameters.assemblyFileVersion }} - - # If parameters.buildTarget is not provided, default to "Build{parameters.packageName}" - buildTarget: ${{ coalesce(parameters.buildTarget, format('Build{0}', parameters.packageName)) }} - - # If parameters.packTarget is not provided, default to "Pack{parameters.packageName}" - packTarget: ${{ coalesce(parameters.packTarget, format('Pack{0}', parameters.packageName)) }} - - steps: - - template: /eng/pipelines/onebranch/steps/script-output-environment-variables-step.yml@self - - # Download any pipeline artifacts this package depends on. - - ${{ each artifact in parameters.downloadArtifacts }}: - - task: DownloadPipelineArtifact@2 - displayName: Download ${{ artifact.displayName }} - inputs: - artifactName: ${{ artifact.artifactName }} - targetPath: $(JOB_INPUT) - - # Install the .NET SDK. - - template: /eng/pipelines/steps/install-dotnet.yml@self - - # Perform Roslyn analysis before building, since this step will clobber build output. - - template: /eng/pipelines/onebranch/steps/roslyn-analyzers-csproj-step.yml@self - parameters: - buildTarget: '${{ variables.buildTarget }}' - msBuildArguments: >- - -p:Configuration=Release - -p:ReferenceType=Package - ${{ parameters.versionProperties }} - - # Build the package, producing DLLs only (no NuGet package yet). - - template: /eng/pipelines/onebranch/steps/build-csproj-step.yml@self - parameters: - buildTarget: '${{ variables.buildTarget }}' - versionProperties: ${{ parameters.versionProperties }} - - - ${{ if eq(parameters.isOfficial, true) }}: - # ESRP sign the DLLs. - - template: /eng/pipelines/onebranch/steps/esrp-dll-signing-step.yml@self - parameters: - appRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' - appRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' - authAkvName: '${{ parameters.signingAuthAkvName }}' - authSignCertName: '${{ parameters.signingAuthSignCertName }}' - esrpClientId: '${{ parameters.signingEsrpClientId }}' - esrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - # Minimatch pattern (multi-line, one pattern per line). - # **/ matches any nested directory (e.g. net8.0/, netstandard2.0/fr/). - # - # Matches: net8.0/.dll - # netstandard2.0/fr/.resources.dll - pattern: | - **/${{ parameters.packageFullName }}.dll - **/${{ parameters.packageFullName }}.resources.dll - - # Copy DLLs to the assemblies/ subdirectory for APIScan. - - task: CopyFiles@2 - displayName: Copy DLLs for APIScan - inputs: - SourceFolder: $(BUILD_OUTPUT)/Package/bin - # Matches: .dll (main assembly) across all TFM subdirs - # .resources.dll (localized satellite assemblies in locale subdirs, if any) - Contents: | - **/${{ parameters.packageFullName }}.dll - **/${{ parameters.packageFullName }}.resources.dll - TargetFolder: $(JOB_OUTPUT)/assemblies - # We must preserve the folder structure since our C# projects may produce multiple - # identically named DLLs for different target frameworks (e.g. netstandard2.0, net5.0, - # etc.), and we need to keep those separate for APIScan to work correctly. - flattenFolders: false - - # Copy PDBs into the output directory so they are included in the published pipeline - # artifact. The symbols publishing stage will download this artifact and publish PDBs - # for this package using the files under symbols/. - - task: CopyFiles@2 - displayName: Copy PDBs for APIScan and Symbols Publishing - inputs: - SourceFolder: $(BUILD_OUTPUT)/Package/bin - # Matches: .pdb across all TFM subdirs. - # Note: Resource DLLs are resource-only satellite assemblies and do not produce PDBs. - Contents: '**/${{ parameters.packageFullName }}.pdb' - TargetFolder: $(JOB_OUTPUT)/symbols - flattenFolders: false - - # Pack the signed DLLs into NuGet package (NoBuild=true). - - template: /eng/pipelines/onebranch/steps/pack-csproj-step.yml@self - parameters: - packTarget: ${{ variables.packTarget }} - versionProperties: ${{ parameters.versionProperties }} - - - ${{ if eq(parameters.isOfficial, true) }}: - # ESRP sign the NuGet package. - - template: /eng/pipelines/onebranch/steps/esrp-nuget-signing-step.yml@self - parameters: - appRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' - appRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' - authAkvName: '${{ parameters.signingAuthAkvName }}' - authSignCertName: '${{ parameters.signingAuthSignCertName }}' - esrpClientId: '${{ parameters.signingEsrpClientId }}' - esrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - searchPath: $(JOB_OUTPUT)/packages - # Minimatch pattern with extglob. - # [0-9] matches a single digit, anchoring to the version segment so - # similarly-prefixed package names are not matched. - # ?(s) is an extglob that optionally matches 's'. - # - # Matches: .1.0.0.nupkg - # .1.0.0-preview.1.snupkg - # Excludes: .SomeOther.1.0.0.nupkg - searchPattern: '${{ parameters.packageFullName }}.[0-9]*.?(s)nupkg' diff --git a/eng/pipelines/onebranch/jobs/build-signed-sqlclient-package-job.yml b/eng/pipelines/onebranch/jobs/build-signed-sqlclient-package-job.yml deleted file mode 100644 index 5bf33f9c09..0000000000 --- a/eng/pipelines/onebranch/jobs/build-signed-sqlclient-package-job.yml +++ /dev/null @@ -1,180 +0,0 @@ -################################################################################# -# Licensed to the .NET Foundation under one or more agreements. # -# The .NET Foundation licenses this file to you under the MIT license. # -# See the LICENSE file in the project root for more information. # -################################################################################# - -# Job that performs a build of Microsoft.Data.SqlClient using the build2.proj file. - -parameters: - # Whether this build is for an "official" OneBranch pipeline. This is used to enable ESRP signing - # on the artifacts of this job. - - name: isOfficial - type: boolean - - - name: signingAppRegistrationClientId - type: string - - - name: signingAppRegistrationTenantId - type: string - - - name: signingAuthAkvName - type: string - - - name: signingAuthSignCertName - type: string - - - name: signingEsrpClientId - type: string - - - name: signingEsrpConnectedServiceName - type: string - - # Package Parameters - - name: abstractionsArtifactName - type: string - - - name: abstractionsPackageVersion - type: string - - - name: loggingArtifactName - type: string - - - name: loggingPackageVersion - type: string - - - name: sqlClientAssemblyFileVersion - type: string - - - name: sqlClientPackageVersion - type: string - -jobs: - - job: build_package_SqlClient - displayName: 'Build Microsoft.Data.SqlClient' - pool: - type: windows - - variables: - ob_outputDirectory: '$(JOB_OUTPUT)' - ob_sdl_apiscan_softwareFolder: $(JOB_OUTPUT)/assemblies - ob_sdl_apiscan_symbolsFolder: $(JOB_OUTPUT)/symbols - ob_sdl_apiscan_softwarename: 'Microsoft.Data.SqlClient' - ob_sdl_apiscan_versionNumber: ${{ parameters.sqlClientAssemblyFileVersion }} - - steps: - # Dump environment and parameters - - template: /eng/pipelines/onebranch/steps/script-output-environment-variables-step.yml@self - - - powershell: | - $jsonParams = '${{ convertToJson(parameters) }}' -replace '\\', '\\' - $jsonParams | ConvertFrom-Json | Format-List - displayName: 'Output Job Parameters' - - # Download Abstractions and Logging packages from previous stages into /packages/ so they - # are available via the local NuGet feed when restoring. - # @TODO: With the new build2.proj pack targets, this technically is not necessary. - - task: DownloadPipelineArtifact@2 - displayName: Download Microsoft.Data.SqlClient.Extensions.Abstractions Artifact - inputs: - artifactName: '${{ parameters.abstractionsArtifactName }}' - targetPath: '$(JOB_INPUT)' - - - task: DownloadPipelineArtifact@2 - displayName: Download Microsoft.Data.SqlClient.Extensions.Logging Artifact - inputs: - artifactName: '${{ parameters.loggingArtifactName }}' - targetPath: '$(JOB_INPUT)' - - # Install the .NET SDK - - template: /eng/pipelines/steps/install-dotnet.yml@self - - # Perform analysis before building, since this step will clobber build output - - template: /eng/pipelines/onebranch/steps/roslyn-analyzers-sqlclient-step.yml@self - parameters: - abstractionsPackageVersion: '${{ parameters.abstractionsPackageVersion }}' - loggingPackageVersion: '${{ parameters.loggingPackageVersion }}' - sqlClientPackageVersion: '${{ parameters.sqlClientPackageVersion }}' - - # Perform the actual build - - template: /eng/pipelines/onebranch/steps/build-sqlclient-step.yml@self - parameters: - abstractionsPackageVersion: '${{ parameters.abstractionsPackageVersion }}' - loggingPackageVersion: '${{ parameters.loggingPackageVersion }}' - sqlClientPackageVersion: '${{ parameters.sqlClientPackageVersion }}' - - # Sign the DLLs - - ${{ if parameters.isOfficial }}: - - template: /eng/pipelines/onebranch/steps/esrp-dll-signing-step.yml@self - parameters: - appRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' - appRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' - authAkvName: '${{ parameters.signingAuthAkvName }}' - authSignCertName: '${{ parameters.signingAuthSignCertName }}' - esrpClientId: '${{ parameters.signingEsrpClientId }}' - esrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - # Minimatch pattern (multi-line, one pattern per line). - # **/ matches any nested directory (e.g. net8.0/, net462/fr/). - # - # Matches: net8.0/Microsoft.Data.SqlClient.dll - # net462/fr/Microsoft.Data.SqlClient.resources.dll - # Excludes: net8.0/Microsoft.Data.SqlClient.SNI.dll (no ** path matches) - pattern: | - **/Microsoft.Data.SqlClient.dll - **/Microsoft.Data.SqlClient.resources.dll - - # Copy DLLs to the assemblies/ subdirectory for APIScan. - - task: CopyFiles@2 - displayName: Copy DLLs for APIScan - inputs: - SourceFolder: '$(BUILD_OUTPUT)/Microsoft.Data.SqlClient/Package-Release' - # Matches: Microsoft.Data.SqlClient.dll (main assembly) - # Microsoft.Data.SqlClient.resources.dll (localized satellite assemblies in locale subdirs) - # Excludes: Microsoft.Data.SqlClient.SNI*.dll (native SNI — not part of this package) - Contents: | - **/Microsoft.Data.SqlClient.dll - **/Microsoft.Data.SqlClient.resources.dll - TargetFolder: '$(JOB_OUTPUT)/assemblies' - flattenFolders: false - - # Copy PDBs into the output directory so they are included in the published pipeline - # artifact. The symbols publishing stage will download this artifact and publish PDBs - # for this package using the files under symbols/. - - task: CopyFiles@2 - displayName: Copy PDBs for APIScan and Symbols Publishing - inputs: - SourceFolder: '$(BUILD_OUTPUT)/Microsoft.Data.SqlClient/Package-Release' - # Matches: Microsoft.Data.SqlClient.pdb (main assembly symbols) - # Excludes: Microsoft.Data.SqlClient.SNI*.pdb (native SNI — symbols published separately) - # Note: Resource DLLs are resource-only satellite assemblies and do not produce PDBs. - Contents: '**/Microsoft.Data.SqlClient.pdb' - TargetFolder: '$(JOB_OUTPUT)/symbols' - flattenFolders: false - - # Package the build output into a NuGet package - - template: /eng/pipelines/onebranch/steps/pack-sqlclient-step.yml - parameters: - abstractionsPackageVersion: '${{ parameters.abstractionsPackageVersion }}' - loggingPackageVersion: '${{ parameters.loggingPackageVersion }}' - sqlClientPackageVersion: '${{ parameters.sqlClientPackageVersion }}' - - # Sign the NuGet packages - - ${{ if parameters.isOfficial }}: - - template: /eng/pipelines/onebranch/steps/esrp-nuget-signing-step.yml@self - parameters: - appRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' - appRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' - authAkvName: '${{ parameters.signingAuthAkvName }}' - authSignCertName: '${{ parameters.signingAuthSignCertName }}' - esrpClientId: '${{ parameters.signingEsrpClientId }}' - esrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - searchPath: '$(JOB_OUTPUT)/packages' - # Minimatch pattern with extglob. - # [0-9] matches a single digit, anchoring to the version segment so - # names like Microsoft.Data.SqlClient.SNI are not matched. - # ?(s) is an extglob that optionally matches 's'. - # - # Matches: Microsoft.Data.SqlClient.6.1.0.nupkg - # Microsoft.Data.SqlClient.6.1.0.snupkg - # Excludes: Microsoft.Data.SqlClient.SNI.6.0.0.nupkg - searchPattern: 'Microsoft.Data.SqlClient.[0-9]*.?(s)nupkg' diff --git a/eng/pipelines/onebranch/jobs/publish-symbols-job.yml b/eng/pipelines/onebranch/jobs/publish-symbols-job.yml index de2d7e4634..8ee37ad7d7 100644 --- a/eng/pipelines/onebranch/jobs/publish-symbols-job.yml +++ b/eng/pipelines/onebranch/jobs/publish-symbols-job.yml @@ -17,20 +17,16 @@ parameters: - name: artifactName type: string - # Short package name used in the job name (e.g. Logging, SqlServer, SqlClient). - - name: packageName - type: string - # The full NuGet package name (e.g. Microsoft.Data.SqlClient.Internal.Logging). - name: packageFullName type: string - # The package version, used for symbol versioning. - - name: packageVersion + # Short package name used in the job name (e.g. Logging, SqlServer, SqlClient). + - name: packageShortName type: string - # Pattern to use to search for PDB files to upload/publish, relative to the symbols folder. - - name: searchPattern + # The package version, used for symbol versioning. + - name: packageVersion type: string # Symbols Publishing Parameters ------------------------------------------ @@ -51,7 +47,7 @@ parameters: type: string jobs: - - job: publish_symbols_${{ parameters.packageName }} + - job: 'publish_symbols_${{ parameters.packageShortName }}' displayName: 'Publish Symbols: ${{ parameters.packageFullName }}' pool: type: linux @@ -69,10 +65,7 @@ jobs: ob_sdl_binskim_enabled: false # Path where the downloaded artifact will be placed. - artifactPath: $(Pipeline.Workspace)/${{ parameters.artifactName }} - - # Path to the PDB files within the downloaded artifact. - symbolsPath: $(Pipeline.Workspace)/${{ parameters.artifactName }}/symbols + artifactPath: '$(Pipeline.Workspace)/${{ parameters.packageFullName }}' # PublishSymbols@2 runs on the OneBranch host agent (outside the build container) due to 1ES # Pipeline Template credential isolation. On Linux, the host resolves to the Microsoft org by @@ -96,7 +89,7 @@ jobs: displayName: 'Download ${{ parameters.packageFullName }} Artifact' inputs: artifactName: '${{ parameters.artifactName }}' - targetPath: '$(artifactPath)' + targetPath: '${{ variables.artifactPath }}' - template: /eng/pipelines/onebranch/steps/publish-symbols-step.yml@self parameters: @@ -108,7 +101,7 @@ jobs: publishToInternal: true publishToPublic: true publishTokenUri: '${{ parameters.symbolsPublishTokenUri }}' - searchPattern: '${{ parameters.searchPattern }}' - symbolsFolder: '$(symbolsPath)' + searchPattern: '**/${{ parameters.packageFullName }}.pdb' + symbolsFolder: '${{ variables.artifactPath }}' uploadAccount: '${{ parameters.symbolsUploadAccount }}' version: '${{ parameters.packageVersion }}' diff --git a/eng/pipelines/onebranch/jobs/validate-signed-package-job.yml b/eng/pipelines/onebranch/jobs/validate-signed-package-job.yml index a99b46d45f..afa5aa5918 100644 --- a/eng/pipelines/onebranch/jobs/validate-signed-package-job.yml +++ b/eng/pipelines/onebranch/jobs/validate-signed-package-job.yml @@ -49,8 +49,8 @@ jobs: variables: # More settings at https://aka.ms/obpipelines/yaml/jobs # Path within the downloaded artifact where NuGet packages are located. - - name: packagesPath - value: '$(Pipeline.Workspace)\${{ parameters.artifactName }}\packages' + - name: artifactPath + value: '$(Pipeline.Workspace)\${{ parameters.artifactName }}' # Path to the SqlClient NuGet package after installation. This path will only exist once the package # been installed. @@ -86,31 +86,62 @@ jobs: - ${{ if eq(parameters.isOfficial, true) }}: - powershell: | # Propagate parameters to PS variables ####################### - $packagesPath = "${{ variables.packagesPath }}" - echo "packagesPath= $packagesPath" + $artifactPath = "${{ variables.artifactPath }}" + echo "artifactPath= $artifactPath" + + # Discover packages ########################################## + $packageFiles = Get-ChildItem -Path $artifactPath -Recurse -File -Include *.nupkg,*.snupkg + if ($packageFiles.Count -eq 0) + { + Write-Error "No NuGet package files were found under '$artifactPath'." + } # Verify package signatures ################################## echo "> 1. Verify signature of source package(s)" - nuget verify -All $packagesPath\*.nupkg + $packageFiles | Where-Object { $_.Extension -eq ".nupkg" } | ForEach-Object { + nuget verify -All $_.FullName + } echo "> 2. Verify signature of symbols package(s)" - nuget verify -All $packagesPath\*.snupkg + $packageFiles | Where-Object { $_.Extension -eq ".snupkg" } | ForEach-Object { + nuget verify -All $_.FullName + } displayName: "Verify nuget signature" # Install NuGet package to the temporary directory - powershell: | # Propagate pipeline to PS variables ############################# - $packagesPath = "${{ variables.packagesPath }}" - echo "packagesPath= $packagesPath" + $artifactPath = "${{ variables.artifactPath }}" + echo "artifactPath= $artifactPath" + + $expectedPackageVersion = "${{ parameters.expectedPackageVersion }}" + echo "expectedPackageVersion= $expectedPackageVersion" $nugetPackageInstallRoot = "${{ variables.nugetPackageInstallRoot }}" echo "nugetPackageInstallRoot= $nugetPackageInstallRoot" + # Find the SqlClient NuGet package ############################### + Get-ChildItem "$artifactPath" -Recurse + + $packagePaths = @(Get-ChildItem -Path $artifactPath -Recurse -File -Filter "Microsoft.Data.SqlClient.$expectedPackageVersion.nupkg") + if ($packagePaths.Count -eq 0) + { + Write-Error "Unable to find Microsoft.Data.SqlClient.$expectedPackageVersion.nupkg under '$artifactPath'." + } + if ($packagePaths.Count -gt 1) + { + Write-Error "Multiple Microsoft.Data.SqlClient.$expectedPackageVersion.nupkg files were found under '$artifactPath'." + } + + $packageSource = Split-Path -Path $packagePaths[0].FullName -Parent + echo "Found package path: $($packagePaths[0].FullName)" + echo "Using package source: $packageSource" + # Install NuGet Package ########################################## echo "> 1. Installing Microsoft.Data.SqlClient NuGet package..." Install-Package ` -Name "Microsoft.Data.SqlClient" ` - -Source "$packagesPath" ` + -Source "$packageSource" ` -Destination $nugetPackageInstallRoot ` -Force ` -SkipDependencies @@ -118,8 +149,6 @@ jobs: echo "> 2. Listing contents of installed Microsoft.Data.SqlClient NuGet package:" Write-Host $nugetPackageInstallRoot Get-ChildItem $nugetPackageInstallRoot - Write-Host "$packagesPath" - Get-ChildItem "$packagesPath" displayName: "Install NuGet Package" # Find all DLL files in the installed NuGet package, verify each is signed with a strong name diff --git a/eng/pipelines/onebranch/stages/build-stages.yml b/eng/pipelines/onebranch/stages/build-stages.yml index 252f63fb0a..096da7e949 100644 --- a/eng/pipelines/onebranch/stages/build-stages.yml +++ b/eng/pipelines/onebranch/stages/build-stages.yml @@ -119,8 +119,12 @@ stages: jobs: - ${{ if or(eq(parameters.buildAkvProvider, true), eq(parameters.buildSqlClient, true)) }}: - - template: /eng/pipelines/onebranch/jobs/build-signed-csproj-package-job.yml@self + # Build Microsoft.Data.SqlClient.Internal.Logging + - template: /eng/pipelines/onebranch/jobs/build-buildproj-job.yml@self parameters: + apiScanDllPath: '$(REPO_ROOT)/apiScan/Microsoft.Data.SqlClient.Internal.Logging/dlls' + apiScanPdbPath: '$(REPO_ROOT)/apiScan/Microsoft.Data.SqlClient.Internal.Logging/pdbs' + shouldSignPackage: ${{ parameters.isOfficial }} signingAppRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' signingAppRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' signingAuthAkvName: '${{ parameters.signingAuthAkvName }}' @@ -128,18 +132,20 @@ stages: signingEsrpClientId: '${{ parameters.signingEsrpClientId }}' signingEsrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - isOfficial: ${{ parameters.isOfficial }} - packageName: Logging - packageFullName: Microsoft.Data.SqlClient.Internal.Logging - versionProperties: >- - -p:LoggingPackageVersion=${{ parameters.loggingPackageVersion }} - -p:LoggingAssemblyFileVersion=${{ parameters.loggingFileVersion }} - assemblyFileVersion: '${{ parameters.loggingFileVersion }}' + dependencies: [] + fileVersion: '${{ parameters.loggingFileVersion }}' + packageFullName: 'Microsoft.Data.SqlClient.Internal.Logging' + packageShortName: 'Logging' + packageVersion: '${{ parameters.loggingPackageVersion }}' - ${{ if eq(parameters.buildSqlServerServer, true) }}: - - template: /eng/pipelines/onebranch/jobs/build-signed-csproj-package-job.yml@self + # Build Microsoft.SqlServer.Server + - template: /eng/pipelines/onebranch/jobs/build-buildproj-job.yml@self parameters: + apiScanDllPath: '$(REPO_ROOT)/apiScan/Microsoft.SqlServer.Server/dlls' + apiScanPdbPath: '$(REPO_ROOT)/apiScan/Microsoft.SqlServer.Server/pdbs' + shouldSignPackage: ${{ parameters.isOfficial }} signingAppRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' signingAppRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' signingAuthAkvName: '${{ parameters.signingAuthAkvName }}' @@ -147,13 +153,11 @@ stages: signingEsrpClientId: '${{ parameters.signingEsrpClientId }}' signingEsrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - isOfficial: ${{ parameters.isOfficial }} - packageName: SqlServer - packageFullName: Microsoft.SqlServer.Server - versionProperties: >- - -p:SqlServerAssemblyFileVersion=${{ parameters.sqlServerFileVersion }} - -p:SqlServerPackageVersion=${{ parameters.sqlServerPackageVersion }} - assemblyFileVersion: '${{ parameters.sqlServerFileVersion }}' + dependencies: [] + fileVersion: '${{ parameters.sqlServerFileVersion }}' + packageFullName: 'Microsoft.SqlServer.Server' + packageShortName: 'SqlServer' + packageVersion: '${{ parameters.sqlServerPackageVersion }}' # ==================================================================== # Stage 2: Abstractions package (depends on Logging from Stage 1) @@ -166,8 +170,12 @@ stages: dependsOn: build_independent jobs: - - template: /eng/pipelines/onebranch/jobs/build-signed-csproj-package-job.yml@self + # Build Microsoft.Data.SqlClient.Extensions.Abstractions + - template: /eng/pipelines/onebranch/jobs/build-buildproj-job.yml@self parameters: + apiScanDllPath: '$(REPO_ROOT)/apiScan/Microsoft.Data.SqlClient.Extensions.Abstractions/dlls' + apiScanPdbPath: '$(REPO_ROOT)/apiScan/Microsoft.Data.SqlClient.Extensions.Abstractions/pdbs' + shouldSignPackage: ${{ parameters.isOfficial }} signingAppRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' signingAppRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' signingAuthAkvName: '${{ parameters.signingAuthAkvName }}' @@ -175,17 +183,14 @@ stages: signingEsrpClientId: '${{ parameters.signingEsrpClientId }}' signingEsrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - isOfficial: ${{ parameters.isOfficial }} - packageName: Abstractions - packageFullName: Microsoft.Data.SqlClient.Extensions.Abstractions - versionProperties: >- - -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - -p:AbstractionsAssemblyFileVersion=${{ parameters.abstractionsFileVersion }} - -p:LoggingPackageVersion=${{ parameters.loggingPackageVersion }} - assemblyFileVersion: '${{ parameters.abstractionsFileVersion }}' - downloadArtifacts: + dependencies: - artifactName: '${{ parameters.loggingArtifactsName }}' - displayName: 'Logging Package' + shortName: 'Logging' + version: '${{ parameters.loggingPackageVersion }}' + fileVersion: '${{ parameters.abstractionsFileVersion }}' + packageFullName: 'Microsoft.Data.SqlClient.Extensions.Abstractions' + packageShortName: 'Abstractions' + packageVersion: '${{ parameters.abstractionsPackageVersion }}' # ==================================================================== # Stage 3: Core packages (depend on Abstractions) @@ -198,9 +203,11 @@ stages: dependsOn: build_abstractions jobs: - - template: /eng/pipelines/onebranch/jobs/build-signed-sqlclient-package-job.yml@self + - template: /eng/pipelines/onebranch/jobs/build-buildproj-job.yml@self parameters: - isOfficial: ${{ parameters.isOfficial }} + apiScanDllPath: '$(REPO_ROOT)/apiScan/Microsoft.Data.SqlClient/dlls' + apiScanPdbPath: '$(REPO_ROOT)/apiScan/Microsoft.Data.SqlClient/pdbs' + shouldSignPackage: ${{ parameters.isOfficial }} signingAppRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' signingAppRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' signingAuthAkvName: '${{ parameters.signingAuthAkvName }}' @@ -208,15 +215,24 @@ stages: signingEsrpClientId: '${{ parameters.signingEsrpClientId }}' signingEsrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - abstractionsArtifactName: '${{ parameters.abstractionsArtifactsName }}' - abstractionsPackageVersion: '${{ parameters.abstractionsPackageVersion }}' - loggingArtifactName: '${{ parameters.loggingArtifactsName }}' - loggingPackageVersion: '${{ parameters.loggingPackageVersion }}' - sqlClientAssemblyFileVersion: '${{ parameters.sqlClientFileVersion }}' - sqlClientPackageVersion: '${{ parameters.sqlClientPackageVersion }}' - - - template: /eng/pipelines/onebranch/jobs/build-signed-csproj-package-job.yml@self + dependencies: + - artifactName: '${{ parameters.abstractionsArtifactsName }}' + shortName: 'Abstractions' + version: '${{ parameters.abstractionsPackageVersion }}' + - artifactName: '${{ parameters.loggingArtifactsName }}' + shortName: 'Logging' + version: '${{ parameters.loggingPackageVersion }}' + fileVersion: '${{ parameters.sqlClientFileVersion }}' + packageFullName: 'Microsoft.Data.SqlClient' + packageShortName: 'SqlClient' + packageVersion: '${{ parameters.sqlClientPackageVersion }}' + + # Build Microsoft.Data.SqlClient.Extensions.Azure + - template: /eng/pipelines/onebranch/jobs/build-buildproj-job.yml@self parameters: + apiScanDllPath: '$(REPO_ROOT)/apiScan/Microsoft.Data.SqlClient.Extensions.Azure/dlls' + apiScanPdbPath: '$(REPO_ROOT)/apiScan/Microsoft.Data.SqlClient.Extensions.Azure/pdbs' + shouldSignPackage: ${{ parameters.isOfficial }} signingAppRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' signingAppRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' signingAuthAkvName: '${{ parameters.signingAuthAkvName }}' @@ -224,20 +240,17 @@ stages: signingEsrpClientId: '${{ parameters.signingEsrpClientId }}' signingEsrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - isOfficial: ${{ parameters.isOfficial }} - packageName: Azure - packageFullName: Microsoft.Data.SqlClient.Extensions.Azure - versionProperties: >- - -p:AzurePackageVersion=${{ parameters.azurePackageVersion }} - -p:AzureAssemblyFileVersion=${{ parameters.azureFileVersion }} - -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - -p:LoggingPackageVersion=${{ parameters.loggingPackageVersion }} - assemblyFileVersion: '${{ parameters.azureFileVersion }}' - downloadArtifacts: + dependencies: - artifactName: '${{ parameters.abstractionsArtifactsName }}' - displayName: Abstractions Package + shortName: 'Abstractions' + version: '${{ parameters.abstractionsPackageVersion }}' - artifactName: '${{ parameters.loggingArtifactsName }}' - displayName: Logging Package + shortName: 'Logging' + version: '${{ parameters.loggingPackageVersion }}' + fileVersion: '${{ parameters.azureFileVersion }}' + packageFullName: 'Microsoft.Data.SqlClient.Extensions.Azure' + packageShortName: 'Azure' + packageVersion: '${{ parameters.azurePackageVersion }}' # ==================================================================== # Stage 4: Add-on packages (depend on core packages) @@ -249,8 +262,11 @@ stages: dependsOn: build_dependent jobs: - - template: /eng/pipelines/onebranch/jobs/build-signed-csproj-package-job.yml@self + - template: /eng/pipelines/onebranch/jobs/build-buildproj-job.yml@self parameters: + apiScanDllPath: '$(REPO_ROOT)/apiScan/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/dlls' + apiScanPdbPath: '$(REPO_ROOT)/apiScan/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/pdbs' + shouldSignPackage: ${{ parameters.isOfficial }} signingAppRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}' signingAppRegistrationTenantId: '${{ parameters.signingAppRegistrationTenantId }}' signingAuthAkvName: '${{ parameters.signingAuthAkvName }}' @@ -258,23 +274,20 @@ stages: signingEsrpClientId: '${{ parameters.signingEsrpClientId }}' signingEsrpConnectedServiceName: '${{ parameters.signingEsrpConnectedServiceName }}' - isOfficial: ${{ parameters.isOfficial }} - packageName: AkvProvider - packageFullName: Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider - versionProperties: >- - -p:AkvPackageVersion=${{ parameters.akvProviderPackageVersion }} - -p:AkvAssemblyFileVersion=${{ parameters.akvProviderFileVersion }} - -p:MdsPackageVersion=${{ parameters.sqlClientPackageVersion }} - -p:LoggingPackageVersion=${{ parameters.loggingPackageVersion }} - -p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }} - assemblyFileVersion: '${{ parameters.akvProviderFileVersion }}' - downloadArtifacts: - - artifactName: '${{ parameters.sqlClientArtifactsName }}' - displayName: SqlClient Package + dependencies: - artifactName: '${{ parameters.abstractionsArtifactsName }}' - displayName: Abstractions Package + shortName: 'Abstractions' + version: '${{ parameters.abstractionsPackageVersion }}' - artifactName: '${{ parameters.loggingArtifactsName }}' - displayName: Logging Package + shortName: 'Logging' + version: '${{ parameters.loggingPackageVersion }}' + - artifactName: '${{ parameters.sqlClientArtifactsName }}' + shortName: 'SqlClient' + version: '${{ parameters.sqlClientPackageVersion }}' + fileVersion: '${{ parameters.akvProviderFileVersion }}' + packageFullName: 'Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider' + packageShortName: 'AkvProvider' + packageVersion: '${{ parameters.akvProviderPackageVersion }}' # ==================================================================== # Validation diff --git a/eng/pipelines/onebranch/stages/publish-symbols-stage.yml b/eng/pipelines/onebranch/stages/publish-symbols-stage.yml index e716d2255d..56e8f827b8 100644 --- a/eng/pipelines/onebranch/stages/publish-symbols-stage.yml +++ b/eng/pipelines/onebranch/stages/publish-symbols-stage.yml @@ -129,11 +129,9 @@ stages: - template: /eng/pipelines/onebranch/jobs/publish-symbols-job.yml@self parameters: artifactName: '${{ parameters.loggingArtifactsName }}' - packageName: Logging packageFullName: Microsoft.Data.SqlClient.Internal.Logging + packageShortName: Logging packageVersion: '${{ parameters.loggingPackageVersion }}' - # Matches: Microsoft.Data.SqlClient.Internal.Logging.pdb across all TFM subdirs. - searchPattern: '**/Microsoft.Data.SqlClient.Internal.Logging.pdb' symbolsAzureSubscription: '${{ parameters.symbolsAzureSubscription }}' symbolsPublishProjectName: '${{ parameters.symbolsPublishProjectName }}' symbolsPublishServer: '${{ parameters.symbolsPublishServer }}' @@ -145,11 +143,9 @@ stages: - template: /eng/pipelines/onebranch/jobs/publish-symbols-job.yml@self parameters: artifactName: '${{ parameters.sqlServerArtifactsName }}' - packageName: SqlServer packageFullName: Microsoft.SqlServer.Server + packageShortName: SqlServer packageVersion: '${{ parameters.sqlServerPackageVersion }}' - # Matches: Microsoft.SqlServer.Server.pdb across all TFM subdirs. - searchPattern: '**/Microsoft.SqlServer.Server.pdb' symbolsAzureSubscription: '${{ parameters.symbolsAzureSubscription }}' symbolsPublishProjectName: '${{ parameters.symbolsPublishProjectName }}' symbolsPublishServer: '${{ parameters.symbolsPublishServer }}' @@ -161,11 +157,9 @@ stages: - template: /eng/pipelines/onebranch/jobs/publish-symbols-job.yml@self parameters: artifactName: '${{ parameters.abstractionsArtifactsName }}' - packageName: Abstractions packageFullName: Microsoft.Data.SqlClient.Extensions.Abstractions + packageShortName: Abstractions packageVersion: '${{ parameters.abstractionsPackageVersion }}' - # Matches: Microsoft.Data.SqlClient.Extensions.Abstractions.pdb across all TFM subdirs. - searchPattern: '**/Microsoft.Data.SqlClient.Extensions.Abstractions.pdb' symbolsAzureSubscription: '${{ parameters.symbolsAzureSubscription }}' symbolsPublishProjectName: '${{ parameters.symbolsPublishProjectName }}' symbolsPublishServer: '${{ parameters.symbolsPublishServer }}' @@ -177,12 +171,9 @@ stages: - template: /eng/pipelines/onebranch/jobs/publish-symbols-job.yml@self parameters: artifactName: '${{ parameters.sqlClientArtifactsName }}' - packageName: SqlClient packageFullName: Microsoft.Data.SqlClient + packageShortName: SqlClient packageVersion: '${{ parameters.sqlClientPackageVersion }}' - # Matches: Microsoft.Data.SqlClient.pdb across all OS/TFM subdirs. - # Excludes: Microsoft.Data.SqlClient.SNI*.pdb (native SNI — symbols published separately). - searchPattern: '**/Microsoft.Data.SqlClient.pdb' symbolsAzureSubscription: '${{ parameters.symbolsAzureSubscription }}' symbolsPublishProjectName: '${{ parameters.symbolsPublishProjectName }}' symbolsPublishServer: '${{ parameters.symbolsPublishServer }}' @@ -194,11 +185,9 @@ stages: - template: /eng/pipelines/onebranch/jobs/publish-symbols-job.yml@self parameters: artifactName: '${{ parameters.azureArtifactsName }}' - packageName: Azure packageFullName: Microsoft.Data.SqlClient.Extensions.Azure + packageShortName: Azure packageVersion: '${{ parameters.azurePackageVersion }}' - # Matches: Microsoft.Data.SqlClient.Extensions.Azure.pdb across all TFM subdirs. - searchPattern: '**/Microsoft.Data.SqlClient.Extensions.Azure.pdb' symbolsAzureSubscription: '${{ parameters.symbolsAzureSubscription }}' symbolsPublishProjectName: '${{ parameters.symbolsPublishProjectName }}' symbolsPublishServer: '${{ parameters.symbolsPublishServer }}' @@ -210,11 +199,9 @@ stages: - template: /eng/pipelines/onebranch/jobs/publish-symbols-job.yml@self parameters: artifactName: '${{ parameters.akvProviderArtifactsName }}' - packageName: AkvProvider packageFullName: Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider + packageShortName: AkvProvider packageVersion: '${{ parameters.akvProviderPackageVersion }}' - # Matches: Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.pdb across all TFM subdirs. - searchPattern: '**/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.pdb' symbolsAzureSubscription: '${{ parameters.symbolsAzureSubscription }}' symbolsPublishProjectName: '${{ parameters.symbolsPublishProjectName }}' symbolsPublishServer: '${{ parameters.symbolsPublishServer }}' diff --git a/eng/pipelines/onebranch/steps/build-buildproj-step.yml b/eng/pipelines/onebranch/steps/build-buildproj-step.yml new file mode 100644 index 0000000000..69c402792e --- /dev/null +++ b/eng/pipelines/onebranch/steps/build-buildproj-step.yml @@ -0,0 +1,64 @@ +################################################################################# +# Licensed to the .NET Foundation under one or more agreements. # +# The .NET Foundation licenses this file to you under the MIT license. # +# See the LICENSE file in the project root for more information. # +################################################################################# + +# This collection of steps to build a project via the build.proj. This will execute the "Build*" +# target in build.proj, where * is the packageShortName provided in the parameters. + +parameters: + # Build configuration - Release or Debug. + - name: buildConfiguration + type: string + values: + - Debug + - Release + + # Optional arguments to pass to msbuild to indicate what version of dependencies should be used. + # They should be in the form of "-p:PackageVersionFooBar=1.2.3 ..." + - name: dependencyArguments + type: string + default: '' + + # Project to build. This short name will be appended to "Build" to generate the appropriate + # target to build from build.proj. + - name: packageShortName + type: string + values: + - Azure + - AkvProvider + - Abstractions + - Logging + - SqlClient + - SqlServer + + # Version to assign to the project to build. This will be passed into msbuild as + # "-p:PackageVersion(packageShortName)". + # @TODO: Make this optional to enable progressively migrating to single-source versioning. + - name: packageVersion + type: string + +steps: + # Download the strong name signing key from secure file storage + - task: DownloadSecureFile@1 + displayName: 'Download Signing Key' + inputs: + secureFile: 'netfxKeypair.snk' + name: keyFile + + - task: MSBuild@1 + displayName: 'build.proj - Build${{ parameters.packageShortName }}' + inputs: + solution: '$(REPO_ROOT)/build.proj' + configuration: '${{ parameters.buildConfiguration }}' + msbuildArguments: >- + -t:Build${{ parameters.packageShortName }} + -p:ReferenceType=Package + -p:SigningKeyPath="$(keyFile.secureFilePath)" + -p:BuildNumber="$(Build.BuildNumber)" + -p:PackageVersion${{ parameters.packageShortName }}="${{ parameters.packageVersion }}" + ${{ parameters.dependencyArguments }} + + - script: tree /a /f $(BUILD_OUTPUT) + displayName: Output Build Output Tree diff --git a/eng/pipelines/onebranch/steps/build-csproj-step.yml b/eng/pipelines/onebranch/steps/build-csproj-step.yml deleted file mode 100644 index a4a38b9fc3..0000000000 --- a/eng/pipelines/onebranch/steps/build-csproj-step.yml +++ /dev/null @@ -1,43 +0,0 @@ -################################################################################# -# Licensed to the .NET Foundation under one or more agreements. # -# The .NET Foundation licenses this file to you under the MIT license. # -# See the LICENSE file in the project root for more information. # -################################################################################# - -# Generic build step for csproj-based packages. Each project uses a build.proj target that runs -# Build only and produces assemblies within $(BUILD_OUTPUT). Downstream ESRP DLL signing must -# locate the assemblies within $(BUILD_OUTPUT) for all target frameworks that the csproj targets. -# NuGet packaging is done separately via pack-csproj-step.yml after DLL signing. - -parameters: - # The MSBuild build target in build.proj (e.g. BuildLogging, BuildAbstractions, - # BuildAzure). - - name: buildTarget - type: string - - # Additional MSBuild arguments for version properties, e.g. - # -p:LoggingPackageVersion=1.0.0 -p:LoggingAssemblyFileVersion=1.0.123 - - name: versionProperties - type: string - default: '' - -steps: - - task: DownloadSecureFile@1 - displayName: Download Signing Key - inputs: - secureFile: netfxKeypair.snk - name: keyFile - - - task: MSBuild@1 - displayName: 'Build.proj - ${{ parameters.buildTarget }}' - inputs: - solution: '$(REPO_ROOT)/build.proj' - configuration: 'Release' - msbuildArguments: >- - -t:${{ parameters.buildTarget }} - -p:ReferenceType=Package - -p:SigningKeyPath=$(keyFile.secureFilePath) - ${{ parameters.versionProperties }} - - - script: tree /a /f $(BUILD_OUTPUT) - displayName: Output Build Output Tree diff --git a/eng/pipelines/onebranch/steps/build-sqlclient-step.yml b/eng/pipelines/onebranch/steps/build-sqlclient-step.yml deleted file mode 100644 index 390d17fc34..0000000000 --- a/eng/pipelines/onebranch/steps/build-sqlclient-step.yml +++ /dev/null @@ -1,41 +0,0 @@ -################################################################################# -# Licensed to the .NET Foundation under one or more agreements. # -# The .NET Foundation licenses this file to you under the MIT license. # -# See the LICENSE file in the project root for more information. # -################################################################################# - -# This collection of steps builds Microsoft.Data.SqlClient via build2.proj - -parameters: - - name: abstractionsPackageVersion - type: string - - - name: loggingPackageVersion - type: string - - - name: sqlClientPackageVersion - type: string - -steps: - - task: DownloadSecureFile@1 - displayName: 'Download Signing Key' - inputs: - secureFile: 'netfxKeypair.snk' - name: keyFile - - - task: MSBuild@1 - displayName: 'Build2.proj - Build SqlClient' - inputs: - solution: '$(REPO_ROOT)/build2.proj' - configuration: 'Release' - msbuildArguments: >- - -t:BuildMds - -p:BuildNumber="$(Build.BuildNumber)" - -p:PackageVersionAbstractions="${{ parameters.abstractionsPackageVersion }}" - -p:PackageVersionLogging="${{ parameters.loggingPackageVersion }}" - -p:PackageVersionMds="${{ parameters.sqlClientPackageVersion }}" - -p:ReferenceType=Package - -p:SigningKeyPath="$(keyFile.secureFilePath)" - - - script: tree /a /f $(BUILD_OUTPUT) - displayName: Output Build Output Tree diff --git a/eng/pipelines/onebranch/steps/pack-buildproj-step.yml b/eng/pipelines/onebranch/steps/pack-buildproj-step.yml new file mode 100644 index 0000000000..a0e6e02426 --- /dev/null +++ b/eng/pipelines/onebranch/steps/pack-buildproj-step.yml @@ -0,0 +1,84 @@ +################################################################################# +# Licensed to the .NET Foundation under one or more agreements. # +# The .NET Foundation licenses this file to you under the MIT license. # +# See the LICENSE file in the project root for more information. # +################################################################################# + +# Generic pack step for build.proj packages. This step runs the Pack* target to generate a NuGet +# package of the target package. The generated NuGet packages will then be copied to $(PACK_OUTPUT). +# +# Note: This step assumes that the package has been built previously using a Build* target. +# `-p:PackBuild=false` will be passed to msbuild to ensure the previously built assemblies are +# not trampled. + +parameters: + # Build configuration - Release or Debug. + - name: buildConfiguration + type: string + values: + - Debug + - Release + + # Optional arguments to pass to msbuild to indicate what version of dependencies should be used. + # They should be in the form of "-p:PackageVersionFooBar=1.2.3 ..." + - name: dependencyArguments + type: string + default: '' + + # The full name of the package. This will be used to generate paths when copying NuGet packages + # out of the build output. + - name: packageFullName + type: string + values: + - Microsoft.Data.SqlClient + - Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider + - Microsoft.Data.SqlClient.Extensions.Abstractions + - Microsoft.Data.SqlClient.Extensions.Azure + - Microsoft.Data.SqlClient.Internal.Logging + - Microsoft.SqlServer.Server + + # Project to build. This short name will be appended to "Pack" to generate the appropriate + # target to package via build.proj. + - name: packageShortName + type: string + values: + - Abstractions + - AkvProvider + - Azure + - Logging + - SqlClient + - SqlServer + + # Version to assign to the project to build. This will be passed into msbuild as + # "-p:PackageVersion(packageShortName)". + # @TODO: Make this optional to enable progressively migrating to single-source versioning. + - name: packageVersion + type: string + +steps: + - task: MSBuild@1 + displayName: 'build.proj - Pack${{ parameters.packageShortName }}' + inputs: + solution: '$(REPO_ROOT)/build.proj' + configuration: '${{ parameters.buildConfiguration }}' + msbuildArguments: >- + -t:Pack${{ parameters.packageShortName }} + -p:PackBuild=false + -p:ReferenceType=Package + -p:BuildNumber="$(Build.BuildNumber)" + -p:PackageVersion${{ parameters.packageShortName }}="${{ parameters.packageVersion }}" + ${{ parameters.dependencyArguments }} + + - script: tree /a /f $(BUILD_OUTPUT) + displayName: Output Build Output Tree + + - task: CopyFiles@2 + displayName: 'Copy NuGet Packages to PACK_OUTPUT' + inputs: + contents: '**/${{ parameters.packageFullName }}*.*nupkg' + flattenFolders: true + sourceFolder: '$(BUILD_OUTPUT)/${{ parameters.packageFullName }}/' + targetFolder: '$(PACK_OUTPUT)' + + - script: tree /a /f $(PACK_OUTPUT) + displayName: Output Package Output Tree diff --git a/eng/pipelines/onebranch/steps/pack-csproj-step.yml b/eng/pipelines/onebranch/steps/pack-csproj-step.yml deleted file mode 100644 index 535106a9d1..0000000000 --- a/eng/pipelines/onebranch/steps/pack-csproj-step.yml +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################# -# Licensed to the .NET Foundation under one or more agreements. # -# The .NET Foundation licenses this file to you under the MIT license. # -# See the LICENSE file in the project root for more information. # -################################################################################# - -# Generic pack step for csproj-based Extension packages (Logging, Abstractions, -# Azure). This step runs the Pack target after DLLs have been signed. The -# NoBuild=true property ensures the DLLs are not rebuilt. - -parameters: - # The MSBuild pack target in build.proj (e.g. PackLogging, PackAbstractions, - # PackAzure). - - name: packTarget - type: string - - # Additional MSBuild arguments for version properties. - - name: versionProperties - type: string - default: '' - -steps: - - task: MSBuild@1 - displayName: 'Build.proj - ${{ parameters.packTarget }}' - inputs: - solution: '$(REPO_ROOT)/build.proj' - configuration: 'Release' - msbuildArguments: >- - -t:${{ parameters.packTarget }} - -p:ReferenceType=Package - -p:PackagesDir=$(JOB_OUTPUT)/packages/ - ${{ parameters.versionProperties }} - - - script: tree /a /f $(JOB_OUTPUT)/packages - displayName: List Pack Output Tree After Pack diff --git a/eng/pipelines/onebranch/steps/pack-sqlclient-step.yml b/eng/pipelines/onebranch/steps/pack-sqlclient-step.yml deleted file mode 100644 index 73229fe834..0000000000 --- a/eng/pipelines/onebranch/steps/pack-sqlclient-step.yml +++ /dev/null @@ -1,42 +0,0 @@ -################################################################################# -# Licensed to the .NET Foundation under one or more agreements. # -# The .NET Foundation licenses this file to you under the MIT license. # -# See the LICENSE file in the project root for more information. # -################################################################################# - -parameters: - # Package version parameters ---- - - name: abstractionsPackageVersion - type: string - - - name: loggingPackageVersion - type: string - - - name: sqlClientPackageVersion - type: string - -steps: - - task: MSBuild@1 - displayName: 'Build2.proj - Pack SqlClient' - inputs: - solution: '$(REPO_ROOT)/build2.proj' - configuration: 'Release' - msbuildArguments: >- - -t:PackMds - -p:BuildNumber="$(Build.BuildNumber)" - -p:PackBuild=false - -p:PackageVersionAbstractions="${{ parameters.abstractionsPackageVersion }}" - -p:PackageVersionLogging="${{ parameters.loggingPackageVersion }}" - -p:PackageVersionMds="${{ parameters.sqlClientPackageVersion }}" - -p:ReferenceType=Package - - - script: tree /a /f $(BUILD_OUTPUT) - displayName: Output Build Output Tree - - - task: CopyFiles@2 - displayName: 'Copy NuGet Packages to JOB_OUTPUT' - inputs: - contents: '**/Microsoft.Data.SqlClient*.*nupkg' - flattenFolders: true - sourceFolder: '$(BUILD_OUTPUT)/Microsoft.Data.SqlClient/' - targetFolder: '$(JOB_OUTPUT)/packages' diff --git a/eng/pipelines/onebranch/steps/roslyn-analyzers-sqlclient-step.yml b/eng/pipelines/onebranch/steps/roslyn-analyzers-buildproj-step.yml similarity index 51% rename from eng/pipelines/onebranch/steps/roslyn-analyzers-sqlclient-step.yml rename to eng/pipelines/onebranch/steps/roslyn-analyzers-buildproj-step.yml index ac515aa021..ba8cb79c83 100644 --- a/eng/pipelines/onebranch/steps/roslyn-analyzers-sqlclient-step.yml +++ b/eng/pipelines/onebranch/steps/roslyn-analyzers-buildproj-step.yml @@ -13,28 +13,44 @@ # steps that perform versioning or signing. parameters: - - name: abstractionsPackageVersion + # Optional arguments to pass to msbuild to indicate what version of dependencies should be used. + - name: dependencyArguments type: string + default: '' - - name: loggingPackageVersion + # Project to build. This short name will be appended to "Build" to generate the appropriate + # target to build from build.proj. + - name: packageShortName type: string + values: + - Abstractions + - AkvProvider + - Azure + - Logging + - SqlClient + - SqlServer - - name: sqlClientPackageVersion + # Version to assign to the project to build. This will be passed into msbuild as + # "-p:PackageVersion(packageShortName)". + # @TODO: Make this optional to enable progressively migrating to single-source versioning. + - name: packageVersion type: string steps: + # GOTCHA: If there are any blank lines in msbuildCommandLine, it will consider it "multiple + # arguments" and fail. So, don't split msBuildCommandLine into multiple blocks. - task: securedevelopmentteam.vss-secure-development-tools.build-task-roslynanalyzers.RoslynAnalyzers@3 - displayName: 'Roslyn Analyzers: build2.proj Build SqlClient' + displayName: 'Roslyn Analyzers - build.proj Build${{ parameters.packageShortName }}' inputs: msBuildArchitecture: x64 msBuildCommandLine: >- msbuild - $(REPO_ROOT)/build2.proj - -t:BuildMds + $(REPO_ROOT)/build.proj + -t:Build${{ parameters.packageShortName }} -p:Configuration=Release - -p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }} - -p:PackageVersionLogging=${{ parameters.loggingPackageVersion }} - -p:PackageVersionMds=${{ parameters.sqlClientPackageVersion }} -p:ReferenceType=Package + -p:BuildNumber="$(Build.BuildNumber)" + -p:PackageVersion${{ parameters.packageShortName }}="${{ parameters.packageVersion }}" + ${{ parameters.dependencyArguments }} msBuildVersion: 17.0 setupCommandLinePicker: vs2022 diff --git a/eng/pipelines/onebranch/steps/roslyn-analyzers-csproj-step.yml b/eng/pipelines/onebranch/steps/roslyn-analyzers-csproj-step.yml deleted file mode 100644 index 53b17d4bb9..0000000000 --- a/eng/pipelines/onebranch/steps/roslyn-analyzers-csproj-step.yml +++ /dev/null @@ -1,39 +0,0 @@ -################################################################################# -# Licensed to the .NET Foundation under one or more agreements. # -# The .NET Foundation licenses this file to you under the MIT license. # -# See the LICENSE file in the project root for more information. # -################################################################################# - -# This template defines a step to run Roslyn Analyzers against builds driven by -# build.proj. It is used for both the full Microsoft.Data.SqlClient (SqlClient) build -# and for individual extension packages; callers control the analyzed targets -# via the msBuildArguments parameter. -# It uses the RoslynAnalyzers@3 task from the Secure Development Team's SDL -# extension: -# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-mohanb/security-integration/guardian-wiki/sdl-azdo-extension/roslyn-analyzers-build-task -# -# GOTCHA: This step will clobber any existing build output. It should be run -# _before_ any build steps that perform versioning or signing. - -parameters: - # Target to build from build.proj. This is separated from the rest of the msBuildArguments to - # provide a rich display name. - - name: buildTarget - type: string - - # Additional build arguments to append to the end of the MSBuild command. - - name: msBuildArguments - type: string - -steps: - - task: securedevelopmentteam.vss-secure-development-tools.build-task-roslynanalyzers.RoslynAnalyzers@3 - displayName: 'Roslyn Analyzers: build.proj ${{ parameters.buildTarget }}' - inputs: - msBuildVersion: 17.0 - msBuildArchitecture: x64 - setupCommandLinePicker: vs2022 - msBuildCommandLine: >- - msbuild - $(REPO_ROOT)\build.proj - -t:${{ parameters.buildTarget }} - ${{ parameters.msBuildArguments }} diff --git a/eng/pipelines/onebranch/variables/common-variables.yml b/eng/pipelines/onebranch/variables/common-variables.yml index 3df1a6264f..5b6209d59d 100644 --- a/eng/pipelines/onebranch/variables/common-variables.yml +++ b/eng/pipelines/onebranch/variables/common-variables.yml @@ -18,8 +18,7 @@ variables: value: $(Build.SourcesDirectory) # This is where our C# projects place their build outputs (see Directory.Build.props - # ). We exclude the reference type here since Official pipelines always use - # Package mode. + # ). - name: BUILD_OUTPUT value: $(REPO_ROOT)/artifacts @@ -30,14 +29,7 @@ variables: - name: JOB_INPUT value: $(REPO_ROOT)/packages - # Root directory for all job output artifacts (NuGet packages, symbols, etc.). - # OneBranch auto-publishes everything under this directory. It is intentionally - # separated from packages/ (where downloaded pipeline artifacts go) so that ESRP - # signing and OneBranch artifact publishing only operate on the current job's output. - # - # Sub-directory layout: - # assemblies/ - DLL assemblies for APIScan (preserving TFM folder structure) - # packages/ - NuGet packages (.nupkg, .snupkg) - # symbols/ - PDB symbol files (preserving TFM folder structure) + # Root directory for all job output artifacts (NuGet packages, symbols, etc.). OneBranch auto + # publishes everything under this directory as the artifact for the job. - name: JOB_OUTPUT value: $(REPO_ROOT)/output diff --git a/eng/pipelines/sqlclient-pr-package-ref-pipeline.yml b/eng/pipelines/sqlclient-pr-package-ref-pipeline.yml index 32921a733e..ba2ff262bf 100644 --- a/eng/pipelines/sqlclient-pr-package-ref-pipeline.yml +++ b/eng/pipelines/sqlclient-pr-package-ref-pipeline.yml @@ -46,7 +46,6 @@ pr: - tools/* - azurepipelines-coverage.yml - build.proj - - build2.proj - Directory.Packages.props - dotnet-tools.json - global.json diff --git a/eng/pipelines/sqlclient-pr-project-ref-pipeline.yml b/eng/pipelines/sqlclient-pr-project-ref-pipeline.yml index 738f8c1b6a..a928175f17 100644 --- a/eng/pipelines/sqlclient-pr-project-ref-pipeline.yml +++ b/eng/pipelines/sqlclient-pr-project-ref-pipeline.yml @@ -46,7 +46,6 @@ pr: - tools/* - azurepipelines-coverage.yml - build.proj - - build2.proj - Directory.Packages.props - dotnet-tools.json - global.json diff --git a/eng/pipelines/stages/build-sqlserver-package-ci-stage.yml b/eng/pipelines/stages/build-sqlserver-package-ci-stage.yml new file mode 100644 index 0000000000..1711725373 --- /dev/null +++ b/eng/pipelines/stages/build-sqlserver-package-ci-stage.yml @@ -0,0 +1,83 @@ +################################################################################ +# Licensed to the .NET Foundation under one or more agreements. The .NET +# Foundation licenses this file to you under the MIT license. See the LICENSE +# file in the project root for more information. +################################################################################ + +# This stage builds the Microsoft.SqlServer.Server package and publishes the +# resulting NuGet packages as pipeline artifacts. +# +# The NuGet packages have the following properties: +# +# Name: Microsoft.SqlServer.Server +# Version: (from parameter) +# +# The following NuGet packages are published: +# +# Microsoft.SqlServer.Server..nupkg +# Microsoft.SqlServer.Server..snupkg (symbols) +# +# The packages are published to pipeline artifacts with the name specified by +# the sqlServerArtifactsName parameter. +# +# This template defines a stage named 'build_sqlserver_package_stage' that +# can be depended on by downstream stages. + +parameters: + + # Additional stages we depend on, if any. + - name: additionalDependsOn + type: object + default: [] + + # The type of build to produce (Release or Debug) + - name: buildConfiguration + type: string + default: Release + values: + - Release + - Debug + + # True to emit debug information and steps. + - name: debug + type: boolean + default: false + + # The name of the pipeline artifacts to publish. + - name: sqlServerArtifactsName + type: string + default: SqlServer.Artifacts + + # The version to apply to the SqlServer NuGet package and DLLs. + - name: sqlServerPackageVersion + type: string + + # The verbosity level for the dotnet CLI commands. + - name: dotnetVerbosity + type: string + default: normal + values: + - quiet + - minimal + - normal + - detailed + - diagnostic + +stages: + + - stage: build_sqlserver_package_stage + displayName: Build SqlServer Package + + dependsOn: + - secrets_stage + - ${{ each dep in parameters.additionalDependsOn }}: + - ${{ dep }} + + jobs: + - template: /eng/pipelines/jobs/pack-sqlserver-package-ci-job.yml@self + parameters: + buildConfiguration: ${{ parameters.buildConfiguration }} + debug: ${{ parameters.debug }} + sqlServerArtifactsName: ${{ parameters.sqlServerArtifactsName }} + sqlServerPackageVersion: ${{ parameters.sqlServerPackageVersion }} + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} diff --git a/eng/pipelines/stages/verify-nuget-packages-ci-stage.yml b/eng/pipelines/stages/verify-nuget-packages-ci-stage.yml index 845f944edb..3dccd61989 100644 --- a/eng/pipelines/stages/verify-nuget-packages-ci-stage.yml +++ b/eng/pipelines/stages/verify-nuget-packages-ci-stage.yml @@ -34,6 +34,10 @@ parameters: type: string default: MDS.Artifacts + - name: sqlServerArtifactsName + type: string + default: SqlServer.Artifacts + stages: - stage: verify_nuget_packages_stage @@ -43,6 +47,7 @@ stages: - build_abstractions_package_stage - build_azure_package_stage - build_logging_package_stage + - build_sqlserver_package_stage - build_sqlclient_package_stage jobs: @@ -85,7 +90,11 @@ stages: artifactName: ${{ parameters.mdsArtifactsName }} targetPath: $(packagesDir) - # TODO: Add SqlServer here when we start building it as part of PR/CI pipelines. + - task: DownloadPipelineArtifact@2 + displayName: Download SqlServer Package Artifacts + inputs: + artifactName: ${{ parameters.sqlServerArtifactsName }} + targetPath: $(packagesDir) # Run the verification tool against all downloaded packages. - template: /eng/pipelines/common/templates/steps/verify-nuget-package-step.yml@self diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 6dcd4bbbd9..6ec3fba9a8 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -12,6 +12,51 @@ Project + + + + true + + + + + + + + + + + + + 0 + $(BuildNumber.Split('.')[0]) + + $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)')) @@ -62,26 +107,6 @@ low - - - - true - - - - - - - - @@ -103,9 +128,6 @@ false - - - diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/.editorconfig b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/.editorconfig similarity index 100% rename from src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/.editorconfig rename to src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/.editorconfig diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/AzureSqlKeyCryptographer.cs b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/AzureSqlKeyCryptographer.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/AzureSqlKeyCryptographer.cs rename to src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/AzureSqlKeyCryptographer.cs diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Constants.cs b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Constants.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Constants.cs rename to src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Constants.cs diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/LocalCache.cs b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/LocalCache.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/LocalCache.cs rename to src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/LocalCache.cs diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj similarity index 66% rename from src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj rename to src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj index bfef481e09..909e36df7f 100644 --- a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj +++ b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj @@ -1,53 +1,37 @@ - - - - - - + + + Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider netstandard2.0 - + - Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider + true Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider - - - $(AkvDefaultMajorVersion).0.0.0 - - $(AkvAssemblyFileVersion) - $(AkvAssemblyFileVersion) - $(AkvPackageVersion) - + + - - $(Artifacts)/obj/$(Configuration)/AzureKeyVaultProvider - $(Artifacts)/bin/$(Configuration)/AzureKeyVaultProvider - true + $(AkvProviderAssemblyVersion) + $(AkvProviderFileVersion) + $(AkvProviderPackageVersion) - + - See: https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target - --> + + + $(RepoRoot)artifacts/ + $(ArtifactPath)$(AssemblyName)/$(Configuration) + + + + $(AssemblyName) - $(AkvPackageVersion) - $(PackagesDir) true snupkg @@ -83,7 +67,6 @@ - - - - - - + + + @@ -106,5 +89,4 @@ - diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/PackageReadme.md b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/PackageReadme.md similarity index 100% rename from src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/PackageReadme.md rename to src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/PackageReadme.md diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/SqlColumnEncryptionAzureKeyVaultProvider.cs b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/SqlColumnEncryptionAzureKeyVaultProvider.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/SqlColumnEncryptionAzureKeyVaultProvider.cs rename to src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/SqlColumnEncryptionAzureKeyVaultProvider.cs diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Strings.Designer.cs b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Strings.Designer.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Strings.Designer.cs rename to src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Strings.Designer.cs diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Strings.resx b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Strings.resx similarity index 100% rename from src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Strings.resx rename to src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Strings.resx diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Utils.cs b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Utils.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Utils.cs rename to src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Utils.cs diff --git a/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Versions.props b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Versions.props new file mode 100644 index 0000000000..25e3ff90ff --- /dev/null +++ b/src/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider/src/Versions.props @@ -0,0 +1,86 @@ + + + + + + + 7.0.0 + + + + + + + + $(AkvProviderPackageVersion.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + $(AkvProviderVersionDefault)-$(BuildSuffix)$(BuildNumber) + $(AkvProviderVersionDefault) + + $(AkvProviderVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + dev + + $(AkvProviderVersionDefault)-$(BuildSuffix) + $(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 edd9144040..45acd55488 100644 --- a/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj +++ b/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj @@ -1,51 +1,19 @@ - - - - - + - netstandard2.0 + Microsoft.Data.SqlClient.Extensions.Abstractions + netstandard2.0 - - - - - - + + true enable enable + Microsoft.Data.SqlClient - - - Microsoft.Data.SqlClient.Extensions.Abstractions - - - - - - $(AbstractionsDefaultMajorVersion).0.0.0 - - $(AbstractionsAssemblyFileVersion) - $(AbstractionsAssemblyFileVersion) - $(AbstractionsPackageVersion) - + @@ -53,36 +21,30 @@ - + + + $(AbstractionsAssemblyVersion) + $(AbstractionsFileVersion) + $(AbstractionsPackageVersion) + - - $(Artifacts)/obj/$(Configuration)/$(AssemblyName) - - - $(Artifacts)/bin/$(Configuration)/$(AssemblyName) - - - true + + + + + + + + $(RepoRoot)artifacts/ + $(ArtifactPath)$(AssemblyName)/$(Configuration)/ - + + $(AssemblyName) - $(AbstractionsPackageVersion) - $(PackagesDir) true snupkg @@ -105,29 +67,15 @@ - - - - - - + + + + + - - - - $(AssemblyName) - - - + + diff --git a/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/AbstractionsVersions.props b/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/AbstractionsVersions.props deleted file mode 100644 index 75be8d98c3..0000000000 --- a/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/AbstractionsVersions.props +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - 1 - - - <_OurPackageVersion Condition="'$(AbstractionsPackageVersion)' != ''">$(AbstractionsPackageVersion) - <_OurPackageVersion Condition="'$(AbstractionsPackageVersion)' == ''">$(AbstractionsDefaultMajorVersion).0.0.$(AssemblyBuildNumber)-dev - - - - <_OurAssemblyFileVersion Condition="'$(AbstractionsAssemblyFileVersion)' != ''">$(AbstractionsAssemblyFileVersion) - - <_OurAssemblyFileVersion Condition="'$(AbstractionsAssemblyFileVersion)' == '' and '$(AbstractionsPackageVersion)' != ''">$(AbstractionsPackageVersion.Split('-')[0]) - - <_OurAssemblyFileVersion Condition="'$(AbstractionsAssemblyFileVersion)' == '' and '$(AbstractionsPackageVersion)' == ''">$(AbstractionsDefaultMajorVersion).0.0.$(AssemblyBuildNumber) - - - $(_OurPackageVersion) - $(_OurAssemblyFileVersion) - - - - diff --git a/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Versions.props b/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Versions.props new file mode 100644 index 0000000000..32330ad3a6 --- /dev/null +++ b/src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Versions.props @@ -0,0 +1,87 @@ + + + + + + + 1.0.0 + + + + + + + + $(AbstractionsPackageVersion.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + $(AbstractionsVersionDefault)-$(BuildSuffix)$(BuildNumber) + $(AbstractionsVersionDefault) + + $(AbstractionsVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + dev + + $(AbstractionsVersionDefault)-$(BuildSuffix) + $(AbstractionsVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + $(AbstractionsFileVersion.Split('.')[0]).0.0.0 + + diff --git a/src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/Abstractions.Test.csproj b/src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/Abstractions.Test.csproj index aeb752d648..427a7aaf9f 100644 --- a/src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/Abstractions.Test.csproj +++ b/src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/Abstractions.Test.csproj @@ -1,29 +1,25 @@  - + + Microsoft.Data.SqlClient.Extensions.Abstractions.Test net462;net8.0;net9.0;net10.0 - enable - enable + false true - Microsoft.Data.SqlClient.Extensions.Abstractions.Test - - - - - - - - - - + + + enable + enable + + + PreserveNewest @@ -31,4 +27,18 @@ + + + + + + + + + + + + + + diff --git a/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Azure.csproj b/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Azure.csproj index b244dd467e..423c55387f 100644 --- a/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Azure.csproj +++ b/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Azure.csproj @@ -1,51 +1,19 @@ - - - - - + - netstandard2.0;net462 + Microsoft.Data.SqlClient.Extensions.Azure + net462;netstandard2.0 - - - - - - + + true enable enable + Microsoft.Data.SqlClient - - - Microsoft.Data.SqlClient.Extensions.Azure - - - - - - $(AzureDefaultMajorVersion).0.0.0 - - $(AzureAssemblyFileVersion) - $(AzureAssemblyFileVersion) - $(AzurePackageVersion) - + @@ -53,36 +21,30 @@ - + + + $(AzureAssemblyVersion) + $(AzureFileVersion) + $(AzurePackageVersion) + - - $(Artifacts)/obj/$(Configuration)/$(AssemblyName) - - - $(Artifacts)/bin/$(Configuration)/$(AssemblyName) - - - true + + + + + + + + $(RepoRoot)artifacts/ + $(ArtifactPath)$(AssemblyName)/$(Configuration)/ - + + $(AssemblyName) - $(AzurePackageVersion) - $(PackagesDir) true snupkg @@ -105,28 +67,24 @@ - - - - - - + + + + + - - - - - - + + + + + @@ -135,18 +93,6 @@ - - - - $(AssemblyName) - + - diff --git a/src/Microsoft.Data.SqlClient.Extensions/Azure/src/AzureVersions.props b/src/Microsoft.Data.SqlClient.Extensions/Azure/src/AzureVersions.props deleted file mode 100644 index 2102cd798a..0000000000 --- a/src/Microsoft.Data.SqlClient.Extensions/Azure/src/AzureVersions.props +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - 1 - - - <_OurPackageVersion Condition="'$(AzurePackageVersion)' != ''">$(AzurePackageVersion) - <_OurPackageVersion Condition="'$(AzurePackageVersion)' == ''">$(AzureDefaultMajorVersion).0.0.$(AssemblyBuildNumber)-dev - - - - <_OurAssemblyFileVersion Condition="'$(AzureAssemblyFileVersion)' != ''">$(AzureAssemblyFileVersion) - - <_OurAssemblyFileVersion Condition="'$(AzureAssemblyFileVersion)' == '' and '$(AzurePackageVersion)' != ''">$(AzurePackageVersion.Split('-')[0]) - - <_OurAssemblyFileVersion Condition="'$(AzureAssemblyFileVersion)' == '' and '$(AzurePackageVersion)' == ''">$(AzureDefaultMajorVersion).0.0.$(AssemblyBuildNumber) - - - $(_OurPackageVersion) - $(_OurAssemblyFileVersion) - - - - diff --git a/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Versions.props b/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Versions.props new file mode 100644 index 0000000000..1876c965eb --- /dev/null +++ b/src/Microsoft.Data.SqlClient.Extensions/Azure/src/Versions.props @@ -0,0 +1,86 @@ + + + + + + + 1.0.0 + + + + + + + + $(AzurePackageVersion.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + $(AzureVersionDefault)-$(BuildSuffix)$(BuildNumber) + $(AzureVersionDefault) + + $(AzureVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + dev + + $(AzureVersionDefault)-$(BuildSuffix) + $(AzureVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + $(AzureFileVersion.Split('.')[0]).0.0.0 + + diff --git a/src/Microsoft.Data.SqlClient.Extensions/Azure/test/Azure.Test.csproj b/src/Microsoft.Data.SqlClient.Extensions/Azure/test/Azure.Test.csproj index 7d2a0c56a5..1c020c2ae4 100644 --- a/src/Microsoft.Data.SqlClient.Extensions/Azure/test/Azure.Test.csproj +++ b/src/Microsoft.Data.SqlClient.Extensions/Azure/test/Azure.Test.csproj @@ -4,23 +4,8 @@ Microsoft.Data.SqlClient.Extensions.Azure.Test Microsoft.Data.SqlClient.Extensions.Azure.Test - enable - true - enable false - - - - Category!=Interactive + true @@ -34,6 +19,12 @@ $(TargetFrameworks);net462 + + + enable + enable + + @@ -56,7 +47,6 @@ Condition="'$(ReferenceType)' == 'Package'"/> - diff --git a/src/Microsoft.Data.SqlClient.Internal/Logging/src/Logging.csproj b/src/Microsoft.Data.SqlClient.Internal/Logging/src/Logging.csproj index 1146e92c8f..f8461d8b92 100644 --- a/src/Microsoft.Data.SqlClient.Internal/Logging/src/Logging.csproj +++ b/src/Microsoft.Data.SqlClient.Internal/Logging/src/Logging.csproj @@ -1,51 +1,21 @@ - - - - - + - netstandard2.0 + Microsoft.Data.SqlClient.Internal.Logging + netstandard2.0 - - - - - - + + true enable enable - - - - - Microsoft.Data.SqlClient.Internal.Logging - - - - - - $(LoggingDefaultMajorVersion).0.0.0 - $(LoggingAssemblyFileVersion) - $(LoggingAssemblyFileVersion) - $(LoggingPackageVersion) + + Microsoft.Data.SqlClient.Internal + + @@ -53,36 +23,30 @@ - + + + $(LoggingAssemblyVersion) + $(LoggingFileVersion) + $(LoggingPackageVersion) + - - $(Artifacts)/obj/$(Configuration)/$(AssemblyName) - - - $(Artifacts)/bin/$(Configuration)/$(AssemblyName) - - - true + + + + + + + + $(RepoRoot)artifacts/ + $(ArtifactPath)$(AssemblyName)/$(Configuration)/ - + + $(AssemblyName) - $(LoggingPackageVersion) - $(PackagesDir) true snupkg @@ -111,18 +75,7 @@ - - - - $(AssemblyName) - + diff --git a/src/Microsoft.Data.SqlClient.Internal/Logging/src/LoggingVersions.props b/src/Microsoft.Data.SqlClient.Internal/Logging/src/LoggingVersions.props deleted file mode 100644 index 9205b88793..0000000000 --- a/src/Microsoft.Data.SqlClient.Internal/Logging/src/LoggingVersions.props +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - 1 - - - <_OurPackageVersion Condition="'$(LoggingPackageVersion)' != ''">$(LoggingPackageVersion) - <_OurPackageVersion Condition="'$(LoggingPackageVersion)' == ''">$(LoggingDefaultMajorVersion).0.0.$(AssemblyBuildNumber)-dev - - - - <_OurAssemblyFileVersion Condition="'$(LoggingAssemblyFileVersion)' != ''">$(LoggingAssemblyFileVersion) - - <_OurAssemblyFileVersion Condition="'$(LoggingAssemblyFileVersion)' == '' and '$(LoggingPackageVersion)' != ''">$(LoggingPackageVersion.Split('-')[0]) - - <_OurAssemblyFileVersion Condition="'$(LoggingAssemblyFileVersion)' == '' and '$(LoggingPackageVersion)' == ''">$(LoggingDefaultMajorVersion).0.0.$(AssemblyBuildNumber) - - - $(_OurPackageVersion) - $(_OurAssemblyFileVersion) - - - - diff --git a/src/Microsoft.Data.SqlClient.Internal/Logging/src/Versions.props b/src/Microsoft.Data.SqlClient.Internal/Logging/src/Versions.props new file mode 100644 index 0000000000..3278bdc2e9 --- /dev/null +++ b/src/Microsoft.Data.SqlClient.Internal/Logging/src/Versions.props @@ -0,0 +1,87 @@ + + + + + + + 1.0.0 + + + + + + + + $(LoggingPackageVersion.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + $(LoggingVersionDefault)-$(BuildSuffix)$(BuildNumber) + $(LoggingVersionDefault) + + $(LoggingVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + dev + + $(LoggingVersionDefault)-$(BuildSuffix) + $(LoggingVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + $(LoggingFileVersion.Split('.')[0]).0.0.0 + + diff --git a/src/Microsoft.Data.SqlClient.slnx b/src/Microsoft.Data.SqlClient.slnx index e08e693479..1b6b3440f8 100644 --- a/src/Microsoft.Data.SqlClient.slnx +++ b/src/Microsoft.Data.SqlClient.slnx @@ -128,7 +128,6 @@ - @@ -137,7 +136,7 @@ - + @@ -151,7 +150,7 @@ - + diff --git a/src/Microsoft.Data.SqlClient/MdsVersions.props b/src/Microsoft.Data.SqlClient/Versions.props similarity index 65% rename from src/Microsoft.Data.SqlClient/MdsVersions.props rename to src/Microsoft.Data.SqlClient/Versions.props index 97063881d9..ea6b557467 100644 --- a/src/Microsoft.Data.SqlClient/MdsVersions.props +++ b/src/Microsoft.Data.SqlClient/Versions.props @@ -3,31 +3,28 @@ This file contains versioning information for the Microsoft.Data.SqlClient package. We will calculate three different version variables, used for different purposes: - * MdsPackageVersion - this will be used as the property, the version of the NuGet - package. It should be in the form: (Major).(Minor).(Patch)[-(Suffix)(BuildNumber)] - * MdsFileVersion - this will be used as the property. It should be in the form: - (Major).(Minor).(Patch).(BuildNumber) - * MdsAssemblyVersion - this will be used as the property. This is the version + * SqlClientAssemblyVersion - this will be used as the property. This is the version reported to user if they open the assembly properties. It *must not* change within major versions in order for minor versions to be considered backwards compatible via strong naming. It must be in the form: (Major).0.0.0 + * SqlClientFileVersion - this will be used as the property. It should be in the form: + (Major).(Minor).(Patch).(BuildNumber) + * SqlClientPackageVersion - this will be used as the property, the version of the NuGet + package. It should be in the form: (Major).(Minor).(Patch)[-(Suffix)(BuildNumber)] --> - - - 7.0.0 - + 7.0.0 - + - $(MdsPackageVersion.Split('-')[0]).$(AssemblyBuildNumber) + $(SqlClientPackageVersion.Split('-')[0]).$(FileVersionBuildNumber) @@ -54,10 +51,10 @@ build pipelines to generate production-ready builds. --> - $(MdsVersionDefault)-$(BuildSuffix)$(AssemblyBuildNumber) - $(MdsVersionDefault) + $(SqlClientVersionDefault)-$(BuildSuffix)$(BuildNumber) + $(SqlClientVersionDefault) - $(MdsVersionDefault.Split('-')[0]).$(AssemblyBuildNumber) + $(SqlClientVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) @@ -71,8 +68,8 @@ dev - $(MdsVersionDefault)-$(BuildSuffix) - $(MdsVersionDefault.Split('-')[0]).$(AssemblyBuildNumber) + $(SqlClientVersionDefault)-$(BuildSuffix) + $(SqlClientVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) @@ -80,9 +77,10 @@ - $(MdsFileVersion.Split('.')[0]).0.0.0 + $(SqlClientFileVersion.Split('.')[0]).0.0.0 - diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/AkvProviderVersions.props b/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/AkvProviderVersions.props deleted file mode 100644 index 47982a6478..0000000000 --- a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/AkvProviderVersions.props +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - 7 - - - <_AkvPackageVersion Condition="'$(AkvPackageVersion)' != ''">$(AkvPackageVersion) - <_AkvPackageVersion Condition="'$(AkvPackageVersion)' == ''">$(AkvDefaultMajorVersion).0.0.$(AssemblyBuildNumber)-dev - - - - <_AkvAssemblyFileVersion Condition="'$(AkvAssemblyFileVersion)' != ''">$(AkvAssemblyFileVersion) - - <_AkvAssemblyFileVersion Condition="'$(AkvAssemblyFileVersion)' == '' and '$(AkvPackageVersion)' != ''">$(AkvPackageVersion.Split('-')[0]) - - <_AkvAssemblyFileVersion Condition="'$(AkvAssemblyFileVersion)' == '' and '$(AkvPackageVersion)' == ''">$(AkvDefaultMajorVersion).0.0.$(AssemblyBuildNumber) - - - $(_AkvPackageVersion) - $(_AkvAssemblyFileVersion) - - - - diff --git a/src/Microsoft.Data.SqlClient/notsupported/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/notsupported/Microsoft.Data.SqlClient.csproj index 4099207511..ca4c73a6ec 100644 --- a/src/Microsoft.Data.SqlClient/notsupported/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/notsupported/Microsoft.Data.SqlClient.csproj @@ -38,9 +38,9 @@ adding a reference from this project to the GenAPI project. Although this is possible, it is not a clean solution (due to reasons related to target frameworks). Thus, building this project assumes the GenAPI project has already been built in a previous step. Instead, use the - following command in build2.proj to build the "not supported" binaries: + following command in build.proj to build the "not supported" binaries: - > msbuild build2.proj /t:BuildMdsNotSupported + > msbuild build.proj /t:BuildSqlClientNotSupported @TODO: Remove this project The primary prerequisite for removing this project is making the "common" MDS project OS- @@ -55,6 +55,11 @@ Microsoft.Data.SqlClient net462;net8.0;net9.0;netstandard2.0 + + + + + enable - + - $(MdsAssemblyVersion) - $(MdsFileVersion) - $(MdsPackageVersion) + $(SqlClientAssemblyVersion) + $(SqlClientFileVersion) + $(SqlClientPackageVersion) + + + diff --git a/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj index dfad9e601c..2895ce5a4a 100644 --- a/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj @@ -1,16 +1,21 @@ + Microsoft.Data.SqlClient net462;net8.0;net9.0;netstandard2.0 + + + + true - + - $(MdsAssemblyVersion) - $(MdsFileVersion) - $(MdsPackageVersion) + $(SqlClientAssemblyVersion) + $(SqlClientFileVersion) + $(SqlClientPackageVersion) @@ -47,6 +52,7 @@ + powershell.exe pwsh diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj index 31a13c5801..cffc9fe96f 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj @@ -2,37 +2,8 @@ Microsoft.Data.SqlClient - Debug;Release; - - true - - true - - - - $(MdsAssemblyVersion) - $(MdsFileVersion) - $(MdsPackageVersion) - - - - - - <_Parameter1>true - - - - - - - - - <_Parameter1>UnitTests - - - @@ -64,9 +35,39 @@ $(TargetFrameworks);net462 + + + true + true + + + + + + + <_Parameter1>true + + + + + + + $(SqlClientAssemblyVersion) + $(SqlClientFileVersion) + $(SqlClientPackageVersion) + + + + + + + + <_Parameter1>UnitTests + + + - $(RepoRoot)artifacts/ @@ -112,6 +113,30 @@ + + + + + + + + + + + + + + + + + + @@ -148,39 +173,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - 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 55bc3b8208..a8fcf7ca88 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/UserAgent.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/UserAgent.cs @@ -14,7 +14,7 @@ namespace Microsoft.Data.SqlClient; /// This class uses runtime environment information to produce a value /// suitable for use in the TDS LOGIN7 USERAGENT Feature Extension /// payload. -/// +/// /// See the spec here: /// /// @@ -24,13 +24,13 @@ namespace Microsoft.Data.SqlClient; internal static class UserAgent { #region Properties - + /// /// /// The pipe-delimited payload as a string, never null, never empty, and /// never larger than 256 characters. /// - /// + /// /// The format is pipe ('|') delimited into 7 parts: /// /// 1|MS-MDS|{Driver Version}|{Arch}|{OS Type}|{OS Info}|{Runtime Info} @@ -63,7 +63,7 @@ internal static class UserAgent /// The {OS Info} part will be sourced from the /// /// OSDescription - /// + /// /// value, or "Unknown" if that value is empty or all whitespace. /// Maximum length is 44 characters. /// @@ -105,7 +105,7 @@ internal static class UserAgent internal static ReadOnlyMemory Ucs2Bytes { get; } #endregion Properties - + #region Helpers /// @@ -145,12 +145,12 @@ static UserAgent() MaxLenOverall, PayloadVersion, DriverName, - System.ThisAssembly.NuGetPackageVersion, + ThisAssembly.NuGetPackageVersion, RuntimeInformation.ProcessArchitecture, osType, RuntimeInformation.OSDescription, RuntimeInformation.FrameworkDescription); - + // Convert it to UCS-2 bytes. // // The default Unicode instance doesn't throw if encoding fails, so @@ -170,25 +170,25 @@ static UserAgent() /// The maximum length of the returned value. /// /// - /// The value of the payload version part. + /// The value of the payload version part. /// /// - /// The value of the driver name part. + /// The value of the driver name part. /// /// - /// The value of the driver version part. + /// The value of the driver version part. /// /// /// The value of the Architecture part. /// /// - /// The value of the OS Type part. + /// The value of the OS Type part. /// /// - /// The value of the OS Info part. + /// The value of the OS Info part. /// /// - /// The value of the Runtime Info part. + /// The value of the Runtime Info part. /// /// /// The payload string value, never null, never empty, and never longer @@ -238,11 +238,11 @@ internal static string Build( // Add the OS Type, truncating to its max length. name.Append(Truncate(Clean(osType), MaxLenOsType)); name.Append('|'); - + // Add the OS Info, truncating to its max length. name.Append(Truncate(Clean(osInfo), MaxLenOsInfo)); name.Append('|'); - + // Add the Runtime Info, truncating to its max length. name.Append(Truncate(Clean(runtimeInfo), MaxLenRuntimeInfo)); @@ -320,7 +320,7 @@ internal static string Clean(string? value) { return Unknown; } - + // Remove any leading and trailing whitespace. value = value.Trim(); @@ -345,7 +345,7 @@ internal static string Clean(string? value) (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') - #endif + #endif || c == ' ' || c == '.' || c == '+' @@ -406,7 +406,7 @@ internal static string Truncate(string value, ushort maxLength) // The overall maximum length of Value. private const ushort MaxLenOverall = 256; - + // Maximum part lengths as promised in our API. private const ushort MaxLenPayloadVersion = 2; private const ushort MaxLenDriverName = 12; diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj index 7045eecc65..3bc6ea9fa7 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj @@ -41,11 +41,6 @@ PreserveNewest xunit.runner.json - - - PreserveNewest - CodeCoverage.runsettings - diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj index 110547a5de..1c1553e6c1 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj @@ -73,10 +73,6 @@ PreserveNewest xunit.runner.json - - PreserveNewest - CodeCoverage.runsettings - @@ -347,7 +343,7 @@ - + @@ -421,5 +417,5 @@ - + diff --git a/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Packages.props b/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Packages.props index e6df2da836..1d19b81910 100644 --- a/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Packages.props +++ b/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Packages.props @@ -3,12 +3,6 @@ - - - true diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj b/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj index 3c35a1a205..96c3c052b1 100644 --- a/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj @@ -34,10 +34,6 @@ PreserveNewest xunit.runner.json - - PreserveNewest - CodeCoverage.runsettings - diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/UserAgentTests.cs b/src/Microsoft.Data.SqlClient/tests/UnitTests/UserAgentTests.cs index 49bd92b399..8331fdb654 100644 --- a/src/Microsoft.Data.SqlClient/tests/UnitTests/UserAgentTests.cs +++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/UserAgentTests.cs @@ -78,12 +78,12 @@ public void Value_Runtime_Parts() Assert.Equal(7, parts.Length); Assert.Equal("1", parts[0]); Assert.Equal("MS-MDS", parts[1]); - Assert.Equal(System.ThisAssembly.NuGetPackageVersion, parts[2]); + Assert.Equal(ThisAssembly.NuGetPackageVersion, parts[2]); // Architecture must be non-empty and 10 characters or less. Assert.True(parts[3] == "Unknown" || parts[3].Length > 0); Assert.True(parts[3].Length <= 10); - + // Check the OS Type against the guaranteed values. var osType = parts[4]; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) @@ -112,7 +112,7 @@ public void Value_Runtime_Parts() // OS Info must be non-empty and 44 characters or less. Assert.True(parts[5] == "Unknown" || parts[5].Length > 0); Assert.True(parts[5].Length <= 44); - + // Runtime Info must be non-empty and 44 characters or less. Assert.True(parts[6] == "Unknown" || parts[6].Length > 0); Assert.True(parts[6].Length <= 44); @@ -145,7 +145,7 @@ public void Ucs2Bytes_Runtime_Parts() #else Encoding.Unicode.GetString(bytes.ToArray()); #endif - + Assert.Equal(UserAgent.Value, value); } @@ -197,7 +197,7 @@ public void Build_Truncate_Payload_Version() "P", UserAgent.Build( 1, "PV", "A", "B", Architecture.X64, "C", "D", "E")); - + // The payload version is longer than its per-field max length of 2. Assert.Equal( "12|A|B|X64|C|D|E", @@ -216,7 +216,7 @@ public void Build_Truncate_Driver_Name() "2|DriverNa", UserAgent.Build( 10, "2", "DriverName", "B", Architecture.X64, "C", "D", "E")); - + // The driver name is longer than its per-field max length of 12. Assert.Equal( "2|LongDriverNa|B|X64|C|D|E", @@ -237,7 +237,7 @@ public void Build_Truncate_Driver_Version() UserAgent.Build( 12, "2", "A", "DriverVersion", Architecture.X64, "C", "D", "E")); - + // The driver version is longer than its per-field max length of 24. Assert.Equal( "2|A|ReallyLongDriverVersionS|X64|C|D|E", @@ -281,7 +281,7 @@ public void Build_Truncate_OS_Type() "2|A|B|X64|LongOs", UserAgent.Build( 16, "2", "A", "B", Architecture.X64, "LongOsName", "D", "E")); - + // The OS Type is longer than its per-field max length of 10. Assert.Equal( "2|A|B|X64|VeryLongOs|D|E", @@ -301,7 +301,7 @@ public void Build_Truncate_OS_Info() "2|A|B|X64|C|LongOsI", UserAgent.Build( 19, "2", "A", "B", Architecture.X64, "C", "LongOsInfo", "E")); - + // The OS Type is longer than its per-field max length of 44. Assert.Equal( "2|A|B|X64|C|01234567890123456789012345678901234567890123|E", @@ -323,7 +323,7 @@ public void Build_Truncate_Runtime_Info() UserAgent.Build( 22, "2", "A", "B", Architecture.X64, "C", "D", "LongRuntimeInfo")); - + // The Runtime Type is longer than its per-field max length of 44. Assert.Equal( "2|A|B|X64|C|D|01234567890123456789012345678901234567890123", @@ -339,7 +339,7 @@ public void Build_Truncate_Runtime_Info() [Fact] public void Build_Truncate_Most() { - var name = + var name = UserAgent.Build( 192, // Payload version > 2 chars. @@ -379,7 +379,7 @@ public void Build_Truncate_Most() [Fact] public void Build_Truncate_All() { - var name = + var name = UserAgent.Build( 192, // Payload version > 2 chars. @@ -536,19 +536,19 @@ public void Truncate() Assert.Equal("", UserAgent.Truncate(" ", 0)); Assert.Equal("", UserAgent.Truncate("A", 0)); Assert.Equal("", UserAgent.Truncate("ABCDE FGHIJ", 0)); - + // Max length of 1. Assert.Equal("", UserAgent.Truncate("", 1)); Assert.Equal(" ", UserAgent.Truncate(" ", 1)); Assert.Equal("A", UserAgent.Truncate("A", 1)); Assert.Equal("A", UserAgent.Truncate("ABCDE FGHIJ", 1)); - + // Max length of 5. Assert.Equal("", UserAgent.Truncate("", 5)); Assert.Equal(" ", UserAgent.Truncate(" ", 5)); Assert.Equal("A", UserAgent.Truncate("A", 5)); Assert.Equal("ABCDE", UserAgent.Truncate("ABCDE FGHIJ", 5)); - + // Max length of 100. Assert.Equal("", UserAgent.Truncate("", 100)); Assert.Equal(" ", UserAgent.Truncate(" ", 100)); diff --git a/src/Microsoft.SqlServer.Server/.editorconfig b/src/Microsoft.SqlServer.Server/.editorconfig deleted file mode 100644 index f700e14ef5..0000000000 --- a/src/Microsoft.SqlServer.Server/.editorconfig +++ /dev/null @@ -1,8 +0,0 @@ -# editorconfig.org - -# top-most EditorConfig file -root = false - -[*.cs] -# CA1310: Specify StringComparison for correctness -dotnet_diagnostic.CA1310.severity = error diff --git a/src/Microsoft.SqlServer.Server/IBinarySerialize.cs b/src/Microsoft.SqlServer.Server/IBinarySerialize.netstandard.cs similarity index 97% rename from src/Microsoft.SqlServer.Server/IBinarySerialize.cs rename to src/Microsoft.SqlServer.Server/IBinarySerialize.netstandard.cs index a975887161..a42c02146e 100644 --- a/src/Microsoft.SqlServer.Server/IBinarySerialize.cs +++ b/src/Microsoft.SqlServer.Server/IBinarySerialize.netstandard.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETSTANDARD + using System.IO; namespace Microsoft.SqlServer.Server @@ -19,3 +21,5 @@ public interface IBinarySerialize void Write(BinaryWriter w); } } + +#endif diff --git a/src/Microsoft.SqlServer.Server/InvalidUdtException.cs b/src/Microsoft.SqlServer.Server/InvalidUdtException.netstandard.cs similarity index 98% rename from src/Microsoft.SqlServer.Server/InvalidUdtException.cs rename to src/Microsoft.SqlServer.Server/InvalidUdtException.netstandard.cs index 395b02af61..87e12e64ac 100644 --- a/src/Microsoft.SqlServer.Server/InvalidUdtException.cs +++ b/src/Microsoft.SqlServer.Server/InvalidUdtException.netstandard.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETSTANDARD + using System; using System.Runtime.Serialization; @@ -49,3 +51,5 @@ public static InvalidUdtException Create(Type udtType, string resourceReason = " } } } + +#endif diff --git a/src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj b/src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj index 74409ebf5e..ead90d9eac 100644 --- a/src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj +++ b/src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj @@ -1,40 +1,31 @@ + Microsoft.SqlServer.Server - This is the helper library for Microsoft.Data.SqlClient for cross framework compatibility support of UDT types. - Microsoft SqlServer Server net46;netstandard2.0 - portable - false - true - + + + $(SqlServerAssemblyVersion) + $(SqlServerFileVersion) + $(SqlServerPackageVersion) + - - $(Artifacts)/obj/$(Configuration)/$(AssemblyName) - - - $(Artifacts)/bin/$(Configuration)/$(AssemblyName) - - - $(Artifacts)/doc/$(TargetFramework)/$(AssemblyName).xml + + + + + $(RepoRoot)artifacts/ + $(ArtifactPath)$(AssemblyName)/$(Configuration)/ - + + $(AssemblyName) - $(SqlServerPackageVersion) - $(PackagesDir) true snupkg @@ -70,34 +61,9 @@ Microsoft.SqlServer.Server.Format - - - - - - - - - - - - - - - - - - - - True - True - Strings.resx - - - ResXFileCodeGenerator - Strings.Designer.cs - - - + + + + diff --git a/src/Microsoft.SqlServer.Server/SqlFacetAttribute.cs b/src/Microsoft.SqlServer.Server/SqlFacetAttribute.netstandard.cs similarity index 98% rename from src/Microsoft.SqlServer.Server/SqlFacetAttribute.cs rename to src/Microsoft.SqlServer.Server/SqlFacetAttribute.netstandard.cs index ba5cd82683..e2e3d555d8 100644 --- a/src/Microsoft.SqlServer.Server/SqlFacetAttribute.cs +++ b/src/Microsoft.SqlServer.Server/SqlFacetAttribute.netstandard.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETSTANDARD + using System; namespace Microsoft.SqlServer.Server @@ -49,3 +51,5 @@ public bool IsNullable } } } + +#endif diff --git a/src/Microsoft.SqlServer.Server/SqlFunctionAttribute.cs b/src/Microsoft.SqlServer.Server/SqlFunctionAttribute.netstandard.cs similarity index 99% rename from src/Microsoft.SqlServer.Server/SqlFunctionAttribute.cs rename to src/Microsoft.SqlServer.Server/SqlFunctionAttribute.netstandard.cs index 4d735cd77f..aed0b27d8b 100644 --- a/src/Microsoft.SqlServer.Server/SqlFunctionAttribute.cs +++ b/src/Microsoft.SqlServer.Server/SqlFunctionAttribute.netstandard.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETSTANDARD + using System; namespace Microsoft.SqlServer.Server @@ -102,3 +104,5 @@ public string FillRowMethodName } } } + +#endif diff --git a/src/Microsoft.SqlServer.Server/SqlMethodAttribute.cs b/src/Microsoft.SqlServer.Server/SqlMethodAttribute.netstandard.cs similarity index 98% rename from src/Microsoft.SqlServer.Server/SqlMethodAttribute.cs rename to src/Microsoft.SqlServer.Server/SqlMethodAttribute.netstandard.cs index a28afa2251..75af831b70 100644 --- a/src/Microsoft.SqlServer.Server/SqlMethodAttribute.cs +++ b/src/Microsoft.SqlServer.Server/SqlMethodAttribute.netstandard.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETSTANDARD + using System; namespace Microsoft.SqlServer.Server @@ -45,3 +47,5 @@ public bool InvokeIfReceiverIsNull } } } + +#endif diff --git a/src/Microsoft.SqlServer.Server/SqlUserDefinedAggregateAttribute.cs b/src/Microsoft.SqlServer.Server/SqlUserDefinedAggregateAttribute.netstandard.cs similarity index 99% rename from src/Microsoft.SqlServer.Server/SqlUserDefinedAggregateAttribute.cs rename to src/Microsoft.SqlServer.Server/SqlUserDefinedAggregateAttribute.netstandard.cs index 6e3e949f16..9a35e6b50d 100644 --- a/src/Microsoft.SqlServer.Server/SqlUserDefinedAggregateAttribute.cs +++ b/src/Microsoft.SqlServer.Server/SqlUserDefinedAggregateAttribute.netstandard.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETSTANDARD + using System; using System.Globalization; @@ -132,3 +134,5 @@ public string Name } } } + +#endif diff --git a/src/Microsoft.SqlServer.Server/SqlUserDefinedTypeAttribute.cs b/src/Microsoft.SqlServer.Server/SqlUserDefinedTypeAttribute.netstandard.cs similarity index 99% rename from src/Microsoft.SqlServer.Server/SqlUserDefinedTypeAttribute.cs rename to src/Microsoft.SqlServer.Server/SqlUserDefinedTypeAttribute.netstandard.cs index 0f24b89150..3f3103ee85 100644 --- a/src/Microsoft.SqlServer.Server/SqlUserDefinedTypeAttribute.cs +++ b/src/Microsoft.SqlServer.Server/SqlUserDefinedTypeAttribute.netstandard.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETSTANDARD + using System; using System.Globalization; @@ -138,3 +140,5 @@ public string Name } } } + +#endif diff --git a/src/Microsoft.SqlServer.Server/StringsHelper.cs b/src/Microsoft.SqlServer.Server/StringsHelper.netstandard.cs similarity index 99% rename from src/Microsoft.SqlServer.Server/StringsHelper.cs rename to src/Microsoft.SqlServer.Server/StringsHelper.netstandard.cs index 8f3915e18c..54d536ffb8 100644 --- a/src/Microsoft.SqlServer.Server/StringsHelper.cs +++ b/src/Microsoft.SqlServer.Server/StringsHelper.netstandard.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETSTANDARD + using System.Globalization; using System.Resources; using System.Runtime.CompilerServices; @@ -32,7 +34,7 @@ private static StringsHelper GetLoader() public static ResourceManager Resources => GetLoader()._resources; - // This method is used to decide if we need to append the exception message parameters to the message when calling Strings.Format. + // This method is used to decide if we need to append the exception message parameters to the message when calling Strings.Format. // by default it returns false. // Native code generators can replace the value this returns based on user input at the time of native code generation. // Marked as NoInlining because if this is used in an AoT compiled app that is not compiled into a single file, the user @@ -129,3 +131,5 @@ public static string Format(string resourceFormat, object p1, object p2, object } } } + +#endif diff --git a/src/Microsoft.SqlServer.Server/TypeForwards.cs b/src/Microsoft.SqlServer.Server/TypeForwards.netfx.cs similarity index 97% rename from src/Microsoft.SqlServer.Server/TypeForwards.cs rename to src/Microsoft.SqlServer.Server/TypeForwards.netfx.cs index 8f1161bce9..6c3cc7c2b3 100644 --- a/src/Microsoft.SqlServer.Server/TypeForwards.cs +++ b/src/Microsoft.SqlServer.Server/TypeForwards.netfx.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETFRAMEWORK + [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.SqlServer.Server.IBinarySerialize))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.SqlServer.Server.InvalidUdtException))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.SqlServer.Server.Format))] @@ -12,4 +14,5 @@ [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.SqlServer.Server.SqlUserDefinedTypeAttribute))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.SqlServer.Server.DataAccessKind))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.SqlServer.Server.SystemDataAccessKind))] -namespace Microsoft.SqlServer.Server { } + +#endif diff --git a/src/Microsoft.SqlServer.Server/Versions.props b/src/Microsoft.SqlServer.Server/Versions.props new file mode 100644 index 0000000000..ec959cafbf --- /dev/null +++ b/src/Microsoft.SqlServer.Server/Versions.props @@ -0,0 +1,87 @@ + + + + + + + 1.0.0 + + + + + + + + $(SqlServerPackageVersion.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + $(SqlServerVersionDefault)-$(BuildSuffix)$(BuildNumber) + $(SqlServerVersionDefault) + + $(SqlServerVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + dev + + $(SqlServerVersionDefault)-$(BuildSuffix) + $(SqlServerVersionDefault.Split('-')[0]).$(FileVersionBuildNumber) + + + + + + + $(SqlServerFileVersion.Split('.')[0]).0.0.0 + + diff --git a/tools/props/Versions.props b/tools/props/Versions.props deleted file mode 100644 index f2132677c9..0000000000 --- a/tools/props/Versions.props +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - 0 - - $(BuildNumber.Split('.')[0]) - - - - - - - - 1.0.0.0 - 1.0.0.0 - 1.0.0.$(AssemblyBuildNumber)-dev - $(SqlServerPackageVersion) - - - - - - - - - - - - - - - - diff --git a/tools/targets/GenerateThisAssemblyCs.targets b/tools/targets/GenerateThisAssemblyCs.targets index 8632d80dc4..6ed66d74ed 100644 --- a/tools/targets/GenerateThisAssemblyCs.targets +++ b/tools/targets/GenerateThisAssemblyCs.targets @@ -11,8 +11,8 @@ $(FileVersion) - - System + + $(AssemblyName) // Licensed to the .NET Foundation under one or more agreements.