Skip to content

Add BuildAll target - #4290

Merged
paulmedynski merged 15 commits into
mainfrom
dev/paul/build-all
Jun 26, 2026
Merged

Add BuildAll target#4290
paulmedynski merged 15 commits into
mainfrom
dev/paul/build-all

Conversation

@paulmedynski

@paulmedynski paulmedynski commented May 14, 2026

Copy link
Copy Markdown
Contributor

Description

Add a BuildAll target that builds every project in the repo — driver libraries, tests, samples, and auxiliary tools — across all supported OS + TargetFramework combinations. This makes it easy for developers to compile all local changes and avoid surprises for code that otherwise wouldn't be compiled on their host OS (for example, net462-only or OS-specific code paths).

BuildAll is now the default build.proj target, so a bare dotnet build compiles the whole repo.

Split from #4259.

Changes

build.proj

  • Set DefaultTargets="BuildAll" so BuildAll runs by default.
  • Added BuildAll, which depends on BuildDriver, BuildTests, BuildSamples, and BuildTools.
  • Renamed the existing Build target to BuildDriver (builds only the driver projects).
  • Added BuildTests with per-project, per-OS (Unix + Windows) build targets for Abstractions, SqlClient Unit/Functional/Manual/Performance/Stress, and Azure test projects. Each forwards the relevant ReferenceType, signing key, and package-version arguments.
  • Added BuildSamples to build the doc/samples/ projects.
  • Added BuildTools to build auxiliary tool/app projects (AzureSqlConnector, PackageCompatibility).
  • Clarified target comments so Pack and Test are documented as operating on the driver projects.
  • Improved build messaging: high-importance summary line plus a separate command line for readability.

Test/tool project files

  • Switched TFM selection from the host OS property to the build-controlled TargetOs property in the test, TestUdts, StressTests, and TDS.EndPoint project files. net462 is now added when TargetOs == Windows_NT, allowing per-OS builds to be driven explicitly from build.proj rather than being implicitly tied to the host OS.

CodeQL workflow

  • Updated the manual build step to run dotnet build build.proj -t:BuildAll for broader code-analysis coverage.

Documentation

  • Updated BUILDGUIDE.md to describe the new default BuildAll behavior, the BuildDriver/BuildTests/BuildSamples/BuildTools targets, and refreshed examples and target tables.

Copilot AI review requested due to automatic review settings May 14, 2026 13:15
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board May 14, 2026
@paulmedynski paulmedynski added this to the 7.1.0-preview2 milestone May 14, 2026
@paulmedynski paulmedynski added the Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems. label May 14, 2026
@paulmedynski paulmedynski moved this from To triage to In progress in SqlClient Board May 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new BuildAll orchestration target in build.proj and updates the CodeQL workflow to build more of the repository during analysis, alongside a handful of MSBuild/props cleanup and minor project tweaks.

Changes:

  • Introduces BuildAll (and supporting BuildTests/BuildSamples/BuildTools) and switches CodeQL to call it.
  • Adds a TrimDocs opt-out for ref-doc trimming to better support cross-build scenarios.
  • Cleans up legacy MSBuild ToolsVersion / DefaultTargets usage and reduces build log noise.

Reviewed changes

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

Show a summary per file
File Description
tools/targets/RepositoryInfo.targets Lowers message verbosity for translated repo URL logging.
tools/props/AssemblyRef.props Removes legacy <Project> attributes.
tools/props/AssemblyInfo.props Removes legacy <Project> attributes.
src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.ruleset Removes obsolete ToolsVersion and normalizes file ending.
src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj Enables implicit usings for the shared test helper project.
src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj Adds TrimDocs switch to optionally skip IntelliSense XML trimming.
src/Directory.Build.props Removes legacy <Project> attributes; clarifies versioning evaluation order.
build.proj Adds BuildAll + ancillary build targets and shared arg handling.
.github/workflows/codeql.yml Switches manual CodeQL build step to BuildAll.

Comment thread build.proj Outdated
Comment thread .github/workflows/codeql.yml
Comment thread src/Directory.Build.props Outdated
Comment thread src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj Outdated
Comment thread build.proj Outdated
Comment thread build.proj Outdated
Comment thread build.proj Outdated
Copilot AI review requested due to automatic review settings May 14, 2026 13:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread build.proj Outdated
Comment thread build.proj
@codecov

codecov Bot commented May 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.45%. Comparing base (c0f341a) to head (2dfcb52).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4290      +/-   ##
==========================================
- Coverage   65.45%   63.45%   -2.00%     
==========================================
  Files         285      280       -5     
  Lines       43373    66265   +22892     
==========================================
+ Hits        28388    42047   +13659     
- Misses      14985    24218    +9233     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 63.45% <ø> (?)

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

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

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

Copilot AI review requested due to automatic review settings May 15, 2026 11:28
Comment thread .gitattributes
Comment thread .gitignore

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.

Comment thread build.proj Outdated
Comment thread build.proj Outdated
@paulmedynski
paulmedynski marked this pull request as ready for review May 15, 2026 16:35
@paulmedynski
paulmedynski requested a review from a team as a code owner May 15, 2026 16:35
Copilot AI review requested due to automatic review settings May 15, 2026 16:35
@paulmedynski
paulmedynski enabled auto-merge (squash) May 15, 2026 16:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread build.proj Outdated

@benrr101 benrr101 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Few issues here.

1

wouldn't be compiled due to their host OS.

I think there's still a fundamental misunderstanding of the build(2).proj behavior. You can build any version on any OS. BuildSqlClient is dependent on BuildSqlClientWindows and BuildSqlClientUnix. The old build.proj would skip Windows on non-windows by default but that's not the case anymore.

2

There's already a "Build" target that builds all projects.

3

There's a lot of microscopic cleanup changes here. The important changes are getting lost in them. Can these be omitted from this PR?

@github-project-automation github-project-automation Bot moved this from In progress to Waiting for customer in SqlClient Board May 20, 2026
@benrr101 benrr101 added the Author attention needed PRs that require author to respond or make updates to PR. label May 20, 2026
apoorvdeshmukh
apoorvdeshmukh previously approved these changes Jun 16, 2026
benrr101
benrr101 previously approved these changes Jun 19, 2026

@cheenamalhotra cheenamalhotra left a comment

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.

I get this error when I run msbuild /t:BuildAll target on Windows on a clean directory, it passes through when running dotnet build -t:BuildAll:

Image

Comment thread build.proj Outdated
@github-project-automation github-project-automation Bot moved this from In review to Waiting for customer in SqlClient Board Jun 23, 2026
@cheenamalhotra

Copy link
Copy Markdown
Member

Conditionally updating SourceRoot may solve this error on this line:

<SourceRoot Update="@(SourceRoot)">

<!--
    Only add the repo root as a SourceRoot when SourceLink is disabled.

    When SourceLink is enabled (the normal case), Microsoft.Build.Tasks.Git
    (pulled in by Microsoft.SourceLink.GitHub) auto-discovers the .git directory
    and adds the working directory as a SourceRoot automatically. Adding our
    own SourceRoot on top causes a duplicate item — and because the manually
    computed path uses whatever drive-letter casing MSBuild captured from the
    invocation (e.g. uppercase 'C:\') while libgit2 may report the same path
    with a different casing (e.g. lowercase 'c:\') on some hosts, MSBuild
    treats them as two distinct items. SourceLink's GetSourceLinkUrl task
    then fails with MSB4094: "Multiple items cannot be passed into a
    parameter of type ITaskItem".

    When SourceLink is disabled, libgit2 is not consulted, so we still
    provide a SourceRoot in case any downstream target needs one.
-->
<ItemGroup Condition="'$(DisableSourceLink)' == 'true'">
    <SourceRoot Include="$(RepoRoot)" />
</ItemGroup>

Change the default target from Build to BuildAll so a bare 'dotnet build'
builds all projects, tests, and samples. Update BUILDGUIDE.md to document
the new default and how to build driver-only with -t:Build. All CI/PR/
OneBranch pipelines pass explicit targets and are unaffected.
Rename the driver-only build target from Build to BuildDriver and update
BuildAll's dependency and the BUILDGUIDE references. Pipelines reference
only Build<package> targets (e.g. BuildSqlClient), so they are unaffected.
Add a BuildTools target that builds the auxiliary tool/app projects:
AzureSqlConnector (doc/apps) and PackageCompatibility (tools). Document
the new target in BUILDGUIDE.md.
BuildAll now also builds the auxiliary tool/app projects. Update BUILDGUIDE
wording to reflect that the default build includes tools.
Copilot AI review requested due to automatic review settings June 23, 2026 11:35
@paulmedynski
paulmedynski dismissed stale reviews from benrr101 and apoorvdeshmukh via 2dfcb52 June 23, 2026 11:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread build.proj
@paulmedynski

Copy link
Copy Markdown
Contributor Author

I get this error when I run msbuild /t:BuildAll target on Windows on a clean directory, it passes through when running dotnet build -t:BuildAll:

Image

@cheenamalhotra - I have no problems using dotnet build or msbuild on Windows. They both build everything successfully from a clean workspace. Can you try again?

@paulmedynski
paulmedynski dismissed cheenamalhotra’s stale review June 23, 2026 12:29

Couldn't reproduce the msbuild errors.

@paulmedynski paulmedynski moved this from Waiting for customer to In review in SqlClient Board Jun 23, 2026

@cheenamalhotra cheenamalhotra left a comment

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.

Tested and msbuild works seamlessly!
Thanks!

@paulmedynski
paulmedynski merged commit bfd81b6 into main Jun 26, 2026
356 checks passed
@paulmedynski
paulmedynski deleted the dev/paul/build-all branch June 26, 2026 09:39
@github-project-automation github-project-automation Bot moved this from In review to Done in SqlClient Board Jun 26, 2026
cheenamalhotra pushed a commit that referenced this pull request Jul 14, 2026
* Add BuildAll target, CodeQL update, and ref csproj cleanup

* Replace ancillary BuildTests with first-class per-project targets

* Use TargetOs instead of OS in test projects for TFM selection

Test projects previously used the built-in $(OS) property to gate
net462 inclusion. This meant passing -p:TargetOs=Windows_NT from
build.proj had no effect on test TFM selection.

Migrate all test csproj files and Directory.Build.props to define
TargetOs (defaulting to $(OS)) and condition on it, matching the
pattern already used by the driver project. This allows BuildAll to
build all TFMs regardless of host OS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants