-
Notifications
You must be signed in to change notification settings - Fork 317
Merge Project | Build the Common Project #3837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Remove runtime identifier/target framework from output path
There was a problem hiding this 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 establishes the foundation for building a unified "common" Microsoft.Data.SqlClient project that consolidates code from the platform-specific netfx and netcore projects. The changes enable conditional target framework selection based on the target OS (net462 only on Windows), introduce OS-aware artifact output paths, and provide new build targets via build2.proj. Key modifications include adding #if NET preprocessor directives to platform-specific files, refactoring UDT exception creation code, updating package references, and adjusting file references in the netcore project to point to renamed SqlDependency files with .netcore.cs extensions.
- Conditional target frameworks: net462 only included when building for Windows
- New artifact directory structure:
artifacts/(AssemblyName)/(Configuration)/(TargetOs)/(TargetFramework) - build2.proj provides BuildMds, BuildMdsUnix, and BuildMdsWindows targets for streamlined builds
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| SqlDependencyUtils.AssemblyLoadContext.netcore.cs | New file with #if NET wrapper for AssemblyLoadContext-based unloading support |
| SqlDependencyUtils.AppDomain.netcore.cs | Added #if NET wrapper to conditionally compile AppDomain unload logic |
| AdapterUtil.cs | Refactored UDT exception creation, improved formatting, moved TraceExceptionAsReturnValue call outside conditional blocks |
| Microsoft.Data.SqlClient.csproj | Added conditional target frameworks, new artifact paths, package reference reorganization for netfx vs netcore |
| netcore/src/Microsoft.Data.SqlClient.csproj | Updated file references from .cs to .netcore.cs for SqlDependencyUtils files |
| Microsoft.Data.SqlClient.sln | Added Build.0 configurations for common project to enable building in Visual Studio |
| build2.proj | New build orchestration file with targets for building common project on Unix and Windows |
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj
Outdated
Show resolved
Hide resolved
edwardneal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No major comments, just a confirmation of Copilot and a quick naming nit.
The commentary about OS-specific handling comes at the same time as I've been looking at what kind of work would be needed to eliminate the need for it entirely. It looks like almost everything can be trivially lifted into runtime checks, with one or two benchmarks to be run for cases where Unix has a slightly different class structure. I'm hoping to start unwinding the need for this soon.
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj
Outdated
Show resolved
Hide resolved
paulmedynski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking for some commentary on a few things, and some suggestions.
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj
Outdated
Show resolved
Hide resolved
mdaigle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly curious if it compiles for framework, because we seem to be missing a lot of references.
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj
Outdated
Show resolved
Hide resolved
…et/sqlclient into dev/russellben/build-common-project ... working on two different machines
There was a problem hiding this 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 6 out of 7 changed files in this pull request and generated 6 comments.
mdaigle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Want to take a close look at the dependencies, but doesn't need to happen in this PR.
| </Target> | ||
|
|
||
| <!-- BuildMdsWindows: Builds all windows-specific MDS binaries --> | ||
| <Target Name="BuildMdsWindows"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget strong name key signing is a MUST.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. I will get that in on this PR. Otherwise, I'll definitely forget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this planned for later?
|
@mdaigle Net462 is building happily - Can't guarantee it all works yet, but that's the goal of the next PR :)
|
There was a problem hiding this 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 6 out of 7 changed files in this pull request and generated 3 comments.
paulmedynski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good! Just a couple of pedantic comments :)
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj
Outdated
Show resolved
Hide resolved
| <ItemGroup Condition="'$(TargetFramework)' != 'net462'"> | ||
| <PackageReference Include="Azure.Core" /> | ||
| <PackageReference Include="Azure.Identity" /> | ||
| <PackageReference Include="Microsoft.Bcl.Cryptography" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also include dependency on Microsoft.Identity.client (MSAL).
It should be present in all projects, I don't recall why it got removed. But, we use its APIs directly in AAD implementation and cannot connect with AAD Auth modes when debugging locally unless its included.
| <!-- References for netcore --> | ||
| <ItemGroup Condition="'$(TargetFramework)' != 'net462'"> | ||
| <PackageReference Include="Azure.Core" /> | ||
| <PackageReference Include="Azure.Identity" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not combine shared dependencies that must be included regardless of target framework?
| -p:TargetOs=Windows_NT | ||
| </DotnetCommand> | ||
| <!-- Convert more than one whitespace character into one space --> | ||
| <DotnetCommand>$([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " "))</DotnetCommand> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this about? Why so much complexity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build proj is outdated build system, I was honestly hoping for a better and modern build system we would use with the unified Dotnet SDK style project. Do we have options to consider?

Description
This PR kicks the tires on building the common project. The goal of this PR was simply to get the common project to build, generate artifacts, and cause no disturbances to existing projects or pipelines. Here's a rundown of the changes:
#if NETwrappers around SqlDependencyUtils.AppDomain.netcore.csartifacts/Microsoft.Data.SqlClient/(configuration)/(targetos)/(targetframework)BuildMds- builds common project for unix and windowsBuildMdsUnix- builds common project for unixBuildMdsWindows- builds common project for windowsdotnetto do the build instead.Testing