assembly 'System.Data.Common' is a framework 4.* assembly. it can not be used with dotnet core. you must have a 4.* framework library reference in your project. you will need to replace it with a dotnet core compatible library.
Problem with NuGet Microsoft Data SqlClient library
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#
6 answers
Sort by: Most helpful
-
Bruce (SqlWork.com) 82,146 Reputation points Volunteer Moderator
2025-10-09T23:13:25.72+00:00 -
Starry Night 625 Reputation points
2025-10-10T03:02:42.6366667+00:00 You can try to follow the steps below to troubleshoot this problem.
- Open up your solution in Visual Studio.
- In Solution Explorer, right-click the References or Dependencies node, and then choose either
Add Project Reference,Add Shared Project Reference, orAdd COM Referencefrom the context menu. - Now the references window will open up - just select the correct DLL with your missing type and hit OK .
-
Tom Spence 25 Reputation points
2025-10-10T10:03:30.5833333+00:00 I have since tried to uninstall / re-install NuGet. Then new error returned -".....................\Microsoft.Data.SqlClient 6.1.2 failed to uninstall. Restart Visual Studio to finish the process." Consecutive restarts have not resolved issue - same error is repeated.
Have then carried out complete uninstall / re-install of Visual Studio 2022, same error is still being repeated
-
Bruce (SqlWork.com) 82,146 Reputation points Volunteer Moderator
2025-10-10T15:53:21.5733333+00:00 you can just delete the /obj & /bin folders to uninstall (if you get a file in use error, that's the same issue VS is having). then run:
dotnet restore
optionally you can edit the project file to remove the package reference.
but the Microsoft.Data.SqlClient package is unrelated to the System.Data.Common assembly reference error.
-
Tom Spence 25 Reputation points
2025-10-11T14:10:12.5233333+00:00 Have deleted the \bin and \obj folders for the project & restarted VS, and didn't get any locked file errors - deletes completed ok. But same error is still being shown " package .....................\Microsoft.Data.SqlClient 6.1.2 failed to uninstall. Restart VS to finish process"
Checked the project file, doesn't contain any reference to the SqlClient package.
If i could get the Microsoft.Data.SqlClient library added to the project i'd be happy, no intention of using the system.Data.Common package for the project.