Skip to content

Conversation

@cheenamalhotra
Copy link
Member

Addresses #3725 - this PR adds a new Sample project for build support.

There are issues with samples that need to be addressed gradually and can be done with community support, but this PR introduces a basic scaffolding to initiate build support.

@cheenamalhotra cheenamalhotra requested a review from a team as a code owner October 31, 2025 21:58
Copilot AI review requested due to automatic review settings October 31, 2025 21:58
Copy link
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

This PR restructures the MSBuild directory hierarchy by moving the root Directory.Build.props from src/ to the repository root, establishing a centralized build configuration approach. This reorganization ensures consistent build properties across the entire repository including source code, tests, and documentation samples.

Key changes:

  • Created a new root Directory.Build.props and Directory.Packages.props at repository level
  • Updated import paths in subdirectories to reference the new root-level build files
  • Added a new samples project (Microsoft.Data.SqlClient.Samples.csproj) to the solution for building documentation code samples
  • Updated namespace names in sample files for consistency

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Directory.Build.props New root-level build properties file with all core MSBuild settings moved from src/
Directory.Packages.props Reformatted with removed blank lines and added Microsoft.Identity.Client package
src/Directory.Build.props Simplified to import parent Directory.Build.props
src/Directory.Package.props New file importing parent Directory.Packages.props
src/Microsoft.Data.SqlClient/tests/Directory.Packages.props Updated import path to reference root-level file
src/Microsoft.Data.SqlClient/add-ons/Directory.Packages.props Updated import path to reference root-level file
doc/Directory.Build.props New file importing tests Directory.Build.props
doc/Directory.Package.props New file importing root Directory.Packages.props
doc/samples/Microsoft.Data.SqlClient.Samples.csproj New samples project for building documentation code samples
doc/samples/*.cs Updated namespaces and added conditional compilation for framework-specific samples
src/Microsoft.Data.SqlClient.sln Added samples project to solution
build.proj Updated import path and added Samples item group

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.57%. Comparing base (0a39567) to head (70db11b).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3740      +/-   ##
==========================================
- Coverage   76.83%   76.57%   -0.26%     
==========================================
  Files         272      272              
  Lines       45363    44177    -1186     
==========================================
- Hits        34854    33828    -1026     
+ Misses      10509    10349     -160     
Flag Coverage Δ
addons 90.82% <ø> (ø)
netcore 76.69% <ø> (+0.07%) ⬆️
netfx 76.19% <ø> (-0.12%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@ErikEJ
Copy link
Contributor

ErikEJ commented Nov 1, 2025

@cheenamalhotra Does the new project build? How do you solve the namespace challenges?

This seems like a lot of product changes to add a validation build of documentation samples.

in my POC, I had simply added a single .csproj in the samples folder (only challenge then was the namespaces)

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net8.0:net9.0;net472</TargetFrameworks>
    <ImplicitUsings>disable</ImplicitUsings>
    <Nullable>disable</Nullable>
    <UseWindowsForms>true</UseWindowsForms>
    <LangVersion>10.0</LangVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Data.SqlClient" Version="7.0.0-preview2.25289.6" />
    <PackageReference Include="Microsoft.SqlServer.Server" Version="1.0.0" />
  </ItemGroup>

</Project>

@paulmedynski paulmedynski self-assigned this Nov 4, 2025
@cheenamalhotra
Copy link
Member Author

cheenamalhotra commented Nov 6, 2025

@cheenamalhotra Does the new project build? How do you solve the namespace challenges?

This seems like a lot of product changes to add a validation build of documentation samples.

in my POC, I had simply added a single .csproj in the samples folder (only challenge then was the namespaces)

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net8.0:net9.0;net472</TargetFrameworks>
    <ImplicitUsings>disable</ImplicitUsings>
    <Nullable>disable</Nullable>
    <UseWindowsForms>true</UseWindowsForms>
    <LangVersion>10.0</LangVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Data.SqlClient" Version="7.0.0-preview2.25289.6" />
    <PackageReference Include="Microsoft.SqlServer.Server" Version="1.0.0" />
  </ItemGroup>

</Project>

Gonna revisit this, to make it simpler as well as do a public driver reference instead. This was a first hand experiment to understand impact of this work, which is indeed a lot (~700 errors). As of now the solution will not build the project so it will need to be worked upon to fix failures.

I mainly want to enable that and allow community to participate in helping us clear out compilation errors, maintaining sample's expected design and behavior.

@cheenamalhotra cheenamalhotra force-pushed the dev/cheena/samples-init branch from 762a382 to 70db11b Compare November 6, 2025 05:39
@ErikEJ
Copy link
Contributor

ErikEJ commented Nov 6, 2025

@cheenamalhotra Sounds good, once the project is in I have some ideas how to make it build.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants