Skip to content

[DRAFT] Remove OS-Specific Builds#4474

Draft
benrr101 wants to merge 7 commits into
mainfrom
dev/russellben/remove-os-build
Draft

[DRAFT] Remove OS-Specific Builds#4474
benrr101 wants to merge 7 commits into
mainfrom
dev/russellben/remove-os-build

Conversation

@benrr101

@benrr101 benrr101 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Description:
This PR is one of a few to finish removing OS-specific-ness in the project. In this step:

  • Removed OS-specific build targets from build.proj (moved to BuildSqlClientImpl to differentiate from ref and notimplemented targets)
  • Removed TargetOs stuff from csproj files, and added net462 to all build targets (Copilot thinks this doesn't work, but it clearly does)
  • Removed OS folder from output path of projects
  • Updated nuspec for MDS to use OS-agnostic assemblies for both windows and unix runtime
    • This is admittedly hacky, but enables in-place change without dramatic deletion of projects. The not-supported project will be deleted in the next step, which will allow the OS-agnostic assemblies to be used directly as the lib assemblies
  • Removed OS-specific behavior from perf test project 🤖

Testing:

  • ✅ build.proj targets work on windows and linux
  • ✅ sqlclient-pr is passing
  • ✅ old PR pipelines are passing
  • 🔄 sqlclient-ci pipeline
  • 🔄 non-official pipeline

Copilot AI review requested due to automatic review settings July 23, 2026 23:53
@benrr101
benrr101 requested a review from a team as a code owner July 23, 2026 23:53
@benrr101 benrr101 added Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems. DO NOT MERGE PRs that are created for test reasons, should not be merged. labels Jul 23, 2026
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Jul 23, 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

This draft PR removes the OS-specific build dimension (Unix vs Windows) from SqlClient’s build and test infrastructure, while preserving the existing NuGet package layout via a temporary “same binaries for all OSes” approach.

Changes:

  • Consolidates build.proj and Kerberos CI steps to use a single BuildSqlClient target instead of per-OS build targets.
  • Updates SqlClient output and packing layout (notably Microsoft.Data.SqlClient.csproj OutputPath and Microsoft.Data.SqlClient.nuspec) to no longer include OS-qualified artifact folders.
  • Simplifies test/perf tooling by removing OS-conditional compilation in some test tools and dropping Windows-only BenchmarkDotNet diagnoser support.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj Removes TargetOs-based multi-targeting logic; updates Package-mode runtime assembly HintPath logic.
src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj Removes explicit Compile item lists and OS-conditional source inclusion.
src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.Unix.cs Deletes the Unix SSPI stub implementation.
src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.cs Adds runtime OS checks to enforce Windows-only SSPI execution.
src/Microsoft.Data.SqlClient/tests/TestUdts/Utf8String/Utf8String.csproj Removes TargetOs-based targeting logic; now multi-targets directly.
src/Microsoft.Data.SqlClient/tests/TestUdts/Shapes/Shapes.csproj Removes TargetOs-based targeting logic; now multi-targets directly.
src/Microsoft.Data.SqlClient/tests/TestUdts/Circle/Circle.csproj Removes TargetOs-based targeting logic; now multi-targets directly.
src/Microsoft.Data.SqlClient/tests/TestUdts/Address/Address.csproj Removes TargetOs-based targeting logic; now multi-targets directly.
src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Build.props Removes TargetOs-based targeting logic for stress test builds.
src/Microsoft.Data.SqlClient/tests/PerformanceTests/runnerconfig.jsonc Removes configuration entries tied to Windows-only diagnosers.
src/Microsoft.Data.SqlClient/tests/PerformanceTests/Program.cs Removes propagation of Windows-only diagnoser config into BenchmarkConfig.
src/Microsoft.Data.SqlClient/tests/PerformanceTests/Microsoft.Data.SqlClient.PerformanceTests.csproj Removes Windows-only BenchmarkDotNet.Diagnostics.Windows dependency and WINDOWS constant.
src/Microsoft.Data.SqlClient/tests/PerformanceTests/Config/Config.cs Removes the Windows-only profiler flag from the config model.
src/Microsoft.Data.SqlClient/tests/PerformanceTests/Config/BenchmarkConfig.cs Removes conditional Windows diagnoser wiring.
src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj Removes TargetOs-based targeting logic; now multi-targets directly.
src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj Removes TargetOs-based targeting logic; now multi-targets directly.
src/Microsoft.Data.SqlClient/tests/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj Removes TargetOs-based targeting logic; now multi-targets directly.
src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj Removes TargetOs-based targeting logic; now multi-targets directly.
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.nuspec Updates packed artifact paths to match non-OS-qualified build outputs while keeping runtime folder structure.
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj Removes TargetOs/NormalizedTargetOs usage; updates TargetFrameworks and OutputPath accordingly.
src/Microsoft.Data.SqlClient.Extensions/Azure/test/Azure.Test.csproj Removes TargetOs-based targeting logic; now multi-targets directly.
eng/pipelines/ci/kerberos/sqlclient-ci-kerberos-pipeline.yml Stops passing OS-specific build targets into the shared Kerberos build step template.
eng/pipelines/ci/kerberos/build-and-test-steps.yml Removes buildTarget parameter and builds via -t:BuildSqlClient.
build.proj Removes per-OS SqlClient build/test targets and replaces with a unified implementation build target.

Comment thread build.proj Outdated
Comment on lines 8 to 10
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>

<!-- We cannot build netfx unless we are building for Windows. Thus, we will only add netfx if -->
<!-- we are building for Windows. -->
<TargetFrameworks Condition="'$(NormalizedTargetOs)' == 'windows_nt'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

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.

This isn't true - linux builds net462 just fine without any extra nonsense.

Comment on lines 11 to 13
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>

<!-- Default TargetOs to host OS if not specified (eg, during IDE development). -->
<TargetOs Condition="'$(TargetOs)' == ''">$(OS)</TargetOs>

<!-- Add net462 when targeting Windows. Building net462 is supported on any host OS. -->
<TargetFrameworks Condition="'$(TargetOs)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks>net462;net8.0;net9.0;net10.0</TargetFrameworks>
</PropertyGroup>
Comment on lines 9 to 12
<!-- Target Frameworks =============================================== -->
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>

<!-- Default TargetOs to host OS if not specified (eg, during IDE development). -->
<TargetOs Condition="'$(TargetOs)' == ''">$(OS)</TargetOs>

<!-- Add net462 when targeting Windows. Building net462 is supported on any host OS. -->
<TargetFrameworks Condition="'$(TargetOs)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks>net462;net8.0;net9.0;net10.0</TargetFrameworks>
</PropertyGroup>
Comment on lines 9 to 12
<!-- Target Frameworks =============================================== -->
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>

<!-- Default TargetOs to host OS if not specified (eg, during IDE development). -->
<TargetOs Condition="'$(TargetOs)' == ''">$(OS)</TargetOs>

<!-- Add net462 when targeting Windows. Building net462 is supported on any host OS. -->
<TargetFrameworks Condition="'$(TargetOs)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks>net462;net8.0;net9.0;net10.0</TargetFrameworks>
</PropertyGroup>

<!-- Add net462 when targeting Windows. Building net462 is supported on any host OS. -->
<TargetFrameworks Condition="'$(TargetOs)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks>net462;net8.0;net9.0;net10.0</TargetFrameworks>
Comment on lines 7 to 10
<!-- Target Frameworks =============================================== -->
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>

<!-- Default TargetOs to host OS if not specified (eg, during IDE development). -->
<TargetOs Condition="'$(TargetOs)' == ''">$(OS)</TargetOs>

<!-- Add net462 when targeting Windows. Building net462 is supported on any host OS. -->
<TargetFrameworks Condition="'$(TargetOs)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks>net462;net8.0;net9.0;net10.0</TargetFrameworks>
</PropertyGroup>
Comment on lines 7 to 10
<!-- Target Frameworks =============================================== -->
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>

<!-- Default TargetOs to host OS if not specified (eg, during IDE development). -->
<TargetOs Condition="'$(TargetOs)' == ''">$(OS)</TargetOs>

<!-- Add net462 when targeting Windows. Building net462 is supported on any host OS. -->
<TargetFrameworks Condition="'$(TargetOs)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks>net462;net8.0;net9.0;net10.0</TargetFrameworks>
</PropertyGroup>
Comment on lines 7 to 10
<!-- Target Frameworks =============================================== -->
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>

<!-- Default TargetOs to host OS if not specified (eg, during IDE development). -->
<TargetOs Condition="'$(TargetOs)' == ''">$(OS)</TargetOs>

<!-- Add net462 when targeting Windows. Building net462 is supported on any host OS. -->
<TargetFrameworks Condition="'$(TargetOs)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks>net462;net8.0;net9.0;net10.0</TargetFrameworks>
</PropertyGroup>
Comment on lines 7 to 10
<!-- Target Frameworks =============================================== -->
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>

<!-- Default TargetOs to host OS if not specified (eg, during IDE development). -->
<TargetOs Condition="'$(TargetOs)' == ''">$(OS)</TargetOs>

<!-- Add net462 when targeting Windows. Building net462 is supported on any host OS. -->
<TargetFrameworks Condition="'$(TargetOs)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks>net462;net8.0;net9.0;net10.0</TargetFrameworks>
</PropertyGroup>
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.51%. Comparing base (d040700) to head (7dc9442).
⚠️ Report is 1 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (d040700) and HEAD (7dc9442). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (d040700) HEAD (7dc9442)
CI-SqlClient 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4474      +/-   ##
==========================================
- Coverage   70.88%   63.51%   -7.37%     
==========================================
  Files         288      283       -5     
  Lines       43935    66821   +22886     
==========================================
+ Hits        31142    42444   +11302     
- Misses      12793    24377   +11584     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 63.51% <ø> (?)

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.

@paulmedynski paulmedynski moved this from To triage to In progress in SqlClient Board Jul 24, 2026
@benrr101
benrr101 marked this pull request as draft July 24, 2026 16:21
Copilot AI review requested due to automatic review settings July 24, 2026 18:00

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 24 out of 24 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.cs:142

  • CreateServer calls ThrowIfNotWindows(), but the SSPIContext constructor also calls it. This results in a redundant OS check (and double work) on the Windows path.

This issue also appears on line 163 of the same file.
src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.cs:168

  • CreateClient calls ThrowIfNotWindows(), but the SSPIContext constructor also calls it. This results in a redundant OS check (and double work) on the Windows path.

Comment on lines 78 to +79
<Reference Include="Microsoft.Data.SqlClient"
HintPath="$(PkgMicrosoft_Data_SqlClient)/runtimes/$(_SqlClientRid)/lib/$(_SqlClientPackageTfm)/Microsoft.Data.SqlClient.dll" />
HintPath="$(PkgMicrosoft_Data_SqlClient)/runtimes/win/lib/$(_SqlClientPackageTfm)/Microsoft.Data.SqlClient.dll" />
Comment on lines 216 to +218
<!-- Runtime Binaries ============================================== -->
<!-- @TODO: This is a temporary measure - removing the not support DLLs will come next -->

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. DO NOT MERGE PRs that are created for test reasons, should not be merged.

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants