Skip to content

Re-introduce .NET Standard 2.0 DLLs #3381

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

cheenamalhotra
Copy link
Member

@cheenamalhotra cheenamalhotra commented May 28, 2025

Addresses #3316

This update brings back .NET Standard DLLs for the lib and ref folders - following the pattern from System.Data.SqlClient NuGet package.

The new NuGet package folder structure shall look like:

lib\
    net462\
    net8.0\
    net9.0\
    netstandard2.0\
ref\
    net462\
    net8.0\
    net9.0\
    netstandard2.0\
runtimes\
    unix\
        lib\
            net8.0\
            net9.0\
    win\
        lib\
            net462\
            net8.0\
            net9.0\

@cheenamalhotra cheenamalhotra added this to the 6.1-preview2 milestone May 28, 2025
@Copilot Copilot AI review requested due to automatic review settings May 28, 2025 04:30
@cheenamalhotra cheenamalhotra requested a review from a team as a code owner May 28, 2025 04:30
Copy link

@Copilot 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 re-introduces .NET Standard 2.0 DLLs for both the lib and ref folders, aligning with the pattern used by the System.Data.SqlClient NuGet package.

  • Updated the nuspec file to add a new targetFramework group for netstandard2.0 and adjust dependency versions.
  • Modified the ref project file to include netstandard2.0 and configure proper output paths using the BuildForLib flag.
  • Enhanced the build.proj file to include a BuildNetStandard target for building the .NET Standard DLLs.

Reviewed Changes

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

File Description
tools/specs/Microsoft.Data.SqlClient.nuspec Added a new targetFramework group for netstandard2.0 and updated dependencies accordingly.
src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj Expanded TargetFrameworks to include netstandard2.0 and introduced conditions for BuildForLib output paths.
src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs Wrapped some API members with conditional compilation (#if NET) for targeted builds.
build.proj Added a BuildNetStandard target and updated dependencies to incorporate .NET Standard builds.

@cheenamalhotra cheenamalhotra linked an issue May 28, 2025 that may be closed by this pull request
Copy link

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.97%. Comparing base (14bee54) to head (d3999a5).
Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3381      +/-   ##
==========================================
+ Coverage   65.07%   67.97%   +2.89%     
==========================================
  Files         298      298              
  Lines       65515    65525      +10     
==========================================
+ Hits        42634    44538    +1904     
+ Misses      22881    20987    -1894     
Flag Coverage Δ
addons 92.58% <ø> (ø)
netcore 72.34% <ø> (+4.00%) ⬆️
netfx 66.46% <ø> (+0.29%) ⬆️

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.

@benrr101
Copy link
Contributor

@cheenamalhotra Will we be reintroducing tests for netstandard builds? I'm concerned that since we removed a lot of code that was specific to netstandard implementation (at least in the interop space), allowing people to compile against ref binaries for netstandard will result in runtime errors. Just checking that this is something we considered.

@cheenamalhotra
Copy link
Member Author

cheenamalhotra commented May 29, 2025

No, because we are only adding compile time assemblies for .NET Standard, not runtime assemblies, we don't need to add changes to src projects and therefore only ref projects are built for .NET Standard target.

Also, .NET Standard is not a runtime framework, it's only a target framework for libraries and reusable components that are shipped as NuGet packages. When a "runtime" framework targets them, respective runtime assemblies are fetched from dependency packages and resolved by .NET/MsBuild SDK.

This is the model of how SDS NuGet package is shipped, we're using the same for MDS now.

Copy link
Contributor

@David-Engel David-Engel left a comment

Choose a reason for hiding this comment

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

LGTM

Where should we document that the NetStandard DLL isn't supported at runtime?

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.

Bring back .NET Standard support
6 participants