Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Microsoft.Data.SqlClient NuGet is needed in some projects but others you can do using Microsoft.Data.SqlClient without the NuGet

In some projects I need to add NuGet package Microsoft.Data.SqlClient to the project before I can do

using Microsoft.Data.SqlClient

In other projects, I can do that without explicitly adding the NuGet package.
The examples below are both .NET 6.0 projects (same for .NET 5).

Referenced directly:
Nuget Microsoft.Data.SqlClient required

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Not referenced directly:
Nuget Microsoft.Data.SqlClient not required

I am wondering how this works.
Is the package referenced indirectly somehow?

>Solution :

AspNetCore.HealthChecks.SqlServer depends on Microsoft.Data.SqlClient:

  • .NETStandard 2.0
    • Microsoft.Data.SqlClient (>= 2.1.2)
    • Microsoft.Extensions.Diagnostics.HealthChecks (>= 5.0.1)
  • net5.0
    • Microsoft.Data.SqlClient (>= 2.1.2)
    • Microsoft.Extensions.Diagnostics.HealthChecks (>= 5.0.1)

so as transitive dependency Microsoft.Data.SqlClient becomes available for you also.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading