Skip to content

build2.proj All the Things#4204

Draft
benrr101 wants to merge 28 commits intomainfrom
dev/russellben/build2
Draft

build2.proj All the Things#4204
benrr101 wants to merge 28 commits intomainfrom
dev/russellben/build2

Conversation

@benrr101
Copy link
Copy Markdown
Contributor

@benrr101 benrr101 commented Apr 17, 2026

Description

This PR moves all projects in the repository to be built, tested, and packed with build2.proj. This style was pioneered with the merge project and this PR migrates all the other projects to this format. Versioning has been updated for each package as well, and explained thoroughly in BUILDGUIDE.md. A new TESTGUIDE.md has been added as well.

🤖

  • Applied changes to CI/PR pipelines after build2.proj changes went into effect. In most cases, there were no changes necessary since CI/PR pipelines currently directly build the projects via a dotnet.
  • Helped with debugging various official/non-official pipeline failures
  • Wrote TESTGUIDE.md
  • Updated instructions for agents

Testing

Local tests of build2.proj is working as intended
Non-official build pipeline is passing:
https://sqlclientdrivers.visualstudio.com/ADO.Net/_build/results?buildId=148136&view=results
https://sqlclientdrivers.visualstudio.com/ADO.Net/_build/results?buildId=148854&view=results
CI/PR pipeline validation is forthcoming.

Work to do before completing PR

[ ] Validate PR/CI pipeline
[ ] Validate Non-official pipeline
[ ] Update agent instructions
[x] Rename build2.proj to build.proj?

@benrr101 benrr101 added this to the 7.1.0-preview1 milestone Apr 17, 2026
Copilot AI review requested due to automatic review settings April 17, 2026 20:54
@benrr101 benrr101 added Area\Documentation Use this for issues that requires changes in public documentations/samples. Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems. labels Apr 17, 2026
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Apr 17, 2026

This comment was marked as outdated.

@cheenamalhotra
Copy link
Copy Markdown
Member

A Big YES to the last item in your checklist 🎉

@paulmedynski paulmedynski moved this from To triage to In review in SqlClient Board Apr 20, 2026
@paulmedynski paulmedynski self-assigned this Apr 20, 2026
Copy link
Copy Markdown
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loving the improvements and consolidation here - looking forward to porting this back to the release branches for a consistent experience.

A few questions and some comment typos to fix.

-p:MdsPackageVersion=${{ parameters.mdsPackageVersion }}
-p:AkvPackageVersion=${{ parameters.akvPackageVersion }}
-p:PackageOutputPath=$(packagePath)
command: pack
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought build2.proj had Pack targets...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, but the pattern for the CI/PR pipelines seems to overwhelmingly be to directly build the csproj files. So rather than change the outlier (AKV Provider using build.proj) to a different outlier (AKV Provider using build2.proj), I changed it to follow the pattern for the other CI/PR pack tasks.

Please note that all of this will be obliterated as part of this semester's pipeline work :)

configuration: '${{ parameters.buildConfiguration }}'
msbuildArguments: >-
-t:BuildAkvProvider
command: build
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No Build target for AKV?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as pack comment applies. Rather than move it from build.proj to build2.proj, I updated it to use the csproj directly like all the other projects in the CI/PR pipelines.


pool:
name: Azure Pipelines
vmImage: ubuntu-latest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we're supposed to use only our 1ES images. The other extensions packages are doing this wrong as well. Just FYI - we will fix this in a future PR once we have appropriate 1ES images setup.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well ... it's been like that since at least 2/24/26. 🤷‍♂️
Not sure why the entire file looks new - this was one of the commits I let the 🤖 handle.

- name: packageName
# 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 to published in a previous job that contains the desired
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of the artifact pubished in a previous ...

# Inform OneBranch that files put in this directory should be uploaded as artifacts.
ob_outputDirectory: $(PACK_OUTPUT)
# Placeholder for dependency package arguments. This will be constructed later as it depends
# on scripting to decompose parameters.dependencies.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parameters.dependencies.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Isn't that what I have?

publishSymbols: ${{ parameters.publishSymbols }}
downloadArtifacts:
dependencies:
- artifactName: '${{ parameters.loggingArtifactsName }}'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach - obvious and readable.

Comment thread BUILDGUIDE.md Outdated
## Versioning

Versioning can be accomplished by using a mix of different parameters to the `build2.proj` targets:
`PackageVersion<TargetProject>`, `BuildNumber`, `and `BuildSuffix`. Using these in different combinations, can generate
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`and

Comment thread BUILDGUIDE.md Outdated
### Running Tests with Reference Type
The above documentation is the default mode of operation, and is the recommended mode for most developers. However,
`build2.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 witheach other, especially in automated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with each

<Link>xunit.runner.json</Link>
</None>

<None Include="$(RepoRoot)src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/CodeCoverage.runsettings">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did these copy commands go?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary anymore, right? They got put into the build2.proj as what gets included if code coverage is turned on?

    <TestCodeCoverage Condition="'$(TestCodeCoverage)' == ''">true</TestCodeCoverage>
    <TestCodeCoverageArgument Condition="'$(TestCodeCoverage.ToLower())' == 'true'">
      --collect "Code coverage"
      --settings "$(RepoRoot)src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/CodeCoverage.runsettings"
    </TestCodeCoverageArgument>

@github-project-automation github-project-automation Bot moved this from In review to In progress in SqlClient Board Apr 20, 2026
Copy link
Copy Markdown
Contributor

@mdaigle mdaigle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the changes make sense to me. Look forward to seeing some pipeline runs.

Comment thread BUILDGUIDE.md
The above documentation is the default mode of operation, and is the recommended mode for most developers. However,
`build2.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 witheach other, especially in automated
build scenarios. For completeness, and debugging of autoamted builds, this section documents behavior of "package mode".
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✏️ automated

Comment thread TESTGUIDE.md
@@ -0,0 +1,311 @@
# Test Guide for Microsoft.Data.SqlClient
Copy link
Copy Markdown
Contributor

@mdaigle mdaigle Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we link to this from BUILDGUIDE rather than duplicating the content?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sections I rewrote, yes, we have links to the TESTGUIDE.

For more
information about test procedures, including config file setup, see TESTGUIDE.md.

Manual test prerequisites and configuration are covered in TESTGUIDE.md.

For the stuff after the sections I rewrote ... well no, I didn't because I guess I figured everything after the sections I rewrote were just about managing runtime switches (which imo, doesn't seem like a great place to put them, but whatever - it's outside the scope of this PR). Since I had the 🤖 write the TESTGUIDE, I'll just tell it to include the stuff about perf testing and databases and whatever.

@benrr101 benrr101 force-pushed the dev/russellben/build2 branch from 9c8cd1c to 6be4e7a Compare April 20, 2026 23:07
@paulmedynski paulmedynski added the Hotfix Candidate 🚑 Issues/PRs that are candidate for backporting to earlier supported versions. label Apr 21, 2026
Comment thread BUILDGUIDE.md

| `<build_target>` | Description |
|:----------------------------|:--------------------------------------------------------------------------------|
| `Build` | Builds all projects for all platforms |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this also the default target?

We should support "msbuild" on the repository (as we've had before) that would build all projects and create NuGet packages for validation with default configuration setup.

Comment thread BUILDGUIDE.md Outdated
dotnet test "src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj" \
-p:Configuration=Release \
--filter "category!=failing&category!=flaky&category!=interactive"
msbuild build2.proj -t:TestSqlClientUnit
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn't be a need to specify name of proj file, if this is the only project file on root folder.

Comment thread build.proj
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this to build.proj?

Copilot AI review requested due to automatic review settings April 22, 2026 00:26
@benrr101 benrr101 force-pushed the dev/russellben/build2 branch from 6be4e7a to 2112bb8 Compare April 22, 2026 00:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

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

Comments suppressed due to low confidence (1)

.github/prompts/release-notes.prompt.md:35

  • The Version Source table still points at files that were removed/renamed in this PR (tools/props/Versions.props, *Versions.props files). This will cause the release-notes prompt to guide agents to non-existent paths and incorrect version properties. Update the table to reference the new per-package Versions.props files (e.g., src/Microsoft.Data.SqlClient/Versions.props, src/Microsoft.Data.SqlClient.Extensions/.../Versions.props, etc.) and the correct property names.
| 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.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) |
| `Internal.Logging` | [LoggingVersions.props](src/Microsoft.Data.SqlClient.Internal/Logging/src/LoggingVersions.props) | [Logging.csproj](src/Microsoft.Data.SqlClient.Internal/Logging/src/Logging.csproj) |


pool:
name: Azure Pipelines
vmImage: ubuntu-latest
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job runs dotnet pack for Microsoft.SqlServer.Server (targets net46;netstandard2.0) on ubuntu-latest. Building net46 TFMs on Linux typically fails without additional reference-assembly packages/config, so this is very likely to break CI. Consider moving this job to a Windows pool (e.g., windows-latest) or adjusting the project/pack step to avoid net46 on non-Windows agents.

Suggested change
vmImage: ubuntu-latest
vmImage: windows-latest

Copilot uses AI. Check for mistakes.
Comment on lines 57 to +69
# 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)
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mdsPackageVersion/sqlServerPackageVersion are using $(AssemblyBuildNumber), but this file defines the build-number variable as assemblyBuildNumber (lowercase). Even if ADO macro expansion treats names case-insensitively, this is inconsistent with the rest of the file and easy to misread. Also, the comment above mdsPackageVersion still references MdsVersions.props, but the repo now uses Versions.props/SqlClientPackageVersion. Please align the variable name usage and update the comment to match the current versioning files/properties.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +15
<!-- Put the ThisAssembly class in the assembly's name namespace by default. -->
<ThisAssemblyNamespace Condition="'$(ThisAssemblyNamespace)' == ''">$(AssemblyName)</ThisAssemblyNamespace>
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the default ThisAssembly namespace from System to $(AssemblyName) is a breaking behavior change for any code that reflects or references System.ThisAssembly (e.g., the stress runner currently looks up assembly.GetType("System.ThisAssembly") and will now return null). Either keep System as the default for backward-compat (and explicitly override ThisAssemblyNamespace in the projects that need uniqueness) or update all downstream consumers that assume System.ThisAssembly.

Copilot uses AI. Check for mistakes.
@benrr101 benrr101 force-pushed the dev/russellben/build2 branch from 2112bb8 to 3976008 Compare April 22, 2026 17:20
Copilot AI review requested due to automatic review settings April 22, 2026 18:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

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

configurationToPack: ${{ parameters.buildConfiguration }}
packDirectory: $(dotnetPackagesDir)
verbosityToPack: ${{ parameters.dotnetVerbosity }}
buildProperties: SqlServerPackageVersion=${{ parameters.sqlServerPackageVersion }}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet pack only passes SqlServerPackageVersion, but src/Microsoft.SqlServer.Server/Versions.props computes SqlServerFileVersion by appending $(FileVersionBuildNumber) (derived from $(BuildNumber)). Since BuildNumber isn't provided here, FileVersionBuildNumber falls back to 0 and file versions will come out as x.y.z.0. Pass BuildNumber=$(Build.BuildNumber) (and any other required version props) via buildProperties so file versions reflect the build.

Suggested change
buildProperties: SqlServerPackageVersion=${{ parameters.sqlServerPackageVersion }}
buildProperties: SqlServerPackageVersion=${{ parameters.sqlServerPackageVersion }};BuildNumber=$(Build.BuildNumber)

Copilot uses AI. Check for mistakes.
Comment on lines 28 to 34
| 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) |
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The versioning/dependency source table is now stale: it still points at tools/props/Versions.props and *Versions.props files that were removed/renamed in this PR (e.g., SqlClient now uses src/Microsoft.Data.SqlClient/Versions.props, and Abstractions/Azure version files are now src/.../Versions.props). Update the table to reference the current versioning sources so the prompt doesn’t direct agents to non-existent files.

Copilot uses AI. Check for mistakes.
Comment thread Directory.Packages.props
Comment on lines 41 to +46
<PackageVersion
Include="Microsoft.Data.SqlClient"
Version="$(MdsPackageVersion)" />
Version="$(SqlClientPackageVersion)" />
<PackageVersion
Include="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider"
Version="$(AkvPackageVersion)" />
Version="$(AkvProviderPackageVersion)" />
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Package reference builds, Microsoft.Data.SqlClient now takes a package reference on Microsoft.SqlServer.Server (see src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj), and CI now builds/publishes a SqlServer artifact with version $(sqlServerPackageVersion) (e.g., 1.0.0-ci...). However, Directory.Packages.props hardcodes Microsoft.SqlServer.Server to 1.0.0, which will cause restore to look for the wrong version when consuming the locally-built artifact. Consider versioning Microsoft.SqlServer.Server here via a $(SqlServerPackageVersion) property (and passing it in CI) for consistency with the other in-repo packages.

Copilot uses AI. Check for mistakes.
benrr101 added 23 commits April 22, 2026 13:56
Migrate the SqlClient csproj files to the same pattern as the other projects.
@benrr101 benrr101 force-pushed the dev/russellben/build2 branch from dea9239 to 1f5e944 Compare April 22, 2026 19:01
Copilot AI review requested due to automatic review settings April 22, 2026 19:55

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Documentation Use this for issues that requires changes in public documentations/samples. Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems. Hotfix Candidate 🚑 Issues/PRs that are candidate for backporting to earlier supported versions.

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

5 participants