Problem with NuGet Microsoft Data SqlClient library

Tom Spence 25 Reputation points
2025-10-09T16:45:12.52+00:00

Microsoft Data SqlClient is referenced in the Visual Studio C Sharp project. Code throws an error ' The type 'IDbColumnSchemaGenerator' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Common, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. NuGet Microsoft.Data.SqlClient is showing as installed. have tried the following console commands

1.'dotnet nuget locals all --clear

2.'dotnet restore

3.'dotnet clean

4.'dotnet build - error 'build failed. But NuGet Microsoft Data SqlClient is reported as installed in NuGet Browse tab

Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} vote

6 answers

Sort by: Most helpful
  1. Tom Spence 25 Reputation points
    2025-10-12T19:09:22.4766667+00:00

    Moving on a bit, installing Microsoft.Data.SqlClient isn't completing fully, attempts to install and then does a roll back near the end of the install with following error : Error Could not find a part of the path 'C:\Users..............................\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.2\buildTransitive/netcoreapp2.0/Microsoft.Extensions.DependencyInjection.Abstractions.targets'.

    Then attempted to repeat NuGet Microsoft.Data.SqlClient install in a completely new effectively blank project ( .NET Framework 4.7.2, Windows Forms App ) and got exactly the same error

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.