Installing NuGet Microsoft Data SqlClient to Visual Studio 2022 desktop project fails

Tom Spence 25 Reputation points
2025-10-23T11:08:12.8333333+00:00

Error reported in Package Manager console :

Adding package 'Microsoft.Extensions.DependencyInjection.Abstractions.8.0.2' to folder 'C:\Users.........\OneDrive\Documents\VISUAL STUDIO 2022\PROJECTS\WORKSHOP\WINFORMS..................\packages'

Install failed. Rolling back...

Package 'Microsoft.Extensions.DependencyInjection.Abstractions.8.0.2 : Microsoft.Bcl.AsyncInterfaces [8.0.0, ), System.Threading.Tasks.Extensions [4.5.4, )' does not exist in project '..............'

Developer technologies | .NET | Other
{count} votes

Answer accepted by question author
  1. Adiba Khan 1,520 Reputation points Microsoft External Staff
    2025-10-29T10:33:28.23+00:00

    Thanks for reaching out.

    Follow these steps to resolve dependency issue:

    1.      Check your project’s target framework

    • If this is desktop WinfFOrms/WPF project (classic .NET Framwork or .NET Core/NET 5-8), make sure the project's TargetFramework is compatible with the NuGet Package's dependencies.
    • For example- if your project is targetting an older .NET framwork version(e.g., net48 or lower) it may not satisfy newer package dependencies.

    2.      Update the required dependency packages

    • Open Package Manager Console (in Visual Studio) or Manage NuGet Packages.
    • Ensure that System.Threading.Tasks.Extensions is installed and has version 4.5.4 or higher. The error message explicitly mentions this version threshold.
    • Also ensure Microsoft.Bcl.AsyncInterfaces is installed with version 8.0.0 or higher (since the error says…. Microsoft.Bcl.AsyncInterfaces [8.0.0,]).
    • After installing/updating these dependencies, retry adding Microsoft.Data.SqlClient.

    3.      Clear any conflicting versions/package cache

    • Sometimes leftover or older package references cause conflicts.
    • In Visual Studio: go to Tools-> NuGet Package Manager -> Package Manager Settings -> General -> Clear All NuGet Caches.
    • Delete bin and obj folders of your project (clean build) and rebuild.

    4.      Check Project File (.csproj)

    • Open your .csproj, look for <PackageReference> entries; confirm that you have something link:
              <PackageReference Include= “System.Threading.Tasks.Extensions” Version=”4.5.4” />
      
              <PackageReference Include= “Microsoft.Bcl.AsyncInterfaces” Version=”8.0.0” />
      
              <PackageReference Include= “Microsoft.Extensions.DependencyInjection.Abstractions” Version=”8.0.2” />
      
              <PackageReference Include=”Microsoft.Data.SqlClient” Version=”x.y.z” />
      
    • Adjust versions as needed (you may choose a version slightly higher than the minimum if available).

    5.      Rebuild and test

    • After making the changes, do a clean and then rebuild your solution.
    • Then retry installing the Microsoft.Data.SqlClient package (or if you already did, uninstall+ reinstall).

    Additional notes and considerations

    • The Microsoft.Extensions.DependencyInjection.Abstractions package version 8.0.2 is published and available.
    • The error is typical when newer libraries depend on newer version of “foundation” package (like System.Threading.Tasks.Extensions) that are not yet present in the project.
    • If your project is a classic .NET framework project (e.g., net48) you may run into compatibility issues with some newer packages meant for .NET 5+/NET 6+. In that case consider using versions of the packages aligned with your target framework.
    • It may help to explicitly install the dependencies before installing the main package to avoid version conflicts.

    Let me know if you need any further help with this. We'll be happy to assist.

    If you find this helpful, Kindly mark the provided solution as "Accept Answer", so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 82,061 Reputation points Volunteer Moderator
    2025-10-23T15:26:48.8066667+00:00

    You probably have one of or both dependencies already in your project but lower than required versions. Update the version of Microsoft.Bcl.AsyncInterfaces and System.Threading.Tasks.Extensions to at least minimum required.

    0 comments No comments

  2. Tom Spence 25 Reputation points
    2025-10-29T12:37:29.7966667+00:00

    Thank you for your instructions and advice, the project is currently built on .NET Framework 4.7.2. There is no indication ( as far as I can see) that the minimum dependency levels are not present for packages. When attempting to install the Microsoft.Extensions.DependencyInjection package to project from Package Manager Console, following events were reported : -

    Attempting to resolve dependencies for package 'microsoft.extensions.dependencyinjection.9.0.10' with DependencyBehavior 'Lowest'

    Resolving dependency information took 0 ms

    Resolving actions to install package 'microsoft.extensions.dependencyinjection.9.0.10'

    Resolved actions to install package 'microsoft.extensions.dependencyinjection.9.0.10'

    Retrieving package 'Microsoft.Extensions.DependencyInjection 9.0.10' from 'nuget.org'.

    Retrieving package 'Microsoft.Extensions.DependencyInjection.Abstractions 9.0.10' from 'nuget.org'.

    GET https://api.nuget.org/v3-flatcontainer/microsoft.extensions.dependencyinjection.abstractions/9.0.10/microsoft.extensions.dependencyinjection.abstractions.9.0.10.nupkg

    GET https://api.nuget.org/v3-flatcontainer/microsoft.extensions.dependencyinjection/9.0.10/microsoft.extensions.dependencyinjection.9.0.10.nupkg

    OK https://api.nuget.org/v3-flatcontainer/microsoft.extensions.dependencyinjection/9.0.10/microsoft.extensions.dependencyinjection.9.0.10.nupkg 21ms

    OK https://api.nuget.org/v3-flatcontainer/microsoft.extensions.dependencyinjection.abstractions/9.0.10/microsoft.extensions.dependencyinjection.abstractions.9.0.10.nupkg 42ms

    Installed Microsoft.Extensions.DependencyInjection 9.0.10 from https://api.nuget.org/v3/index.json to C:\Users.......nuget\packages\microsoft.extensions.dependencyinjection\9.0.10 with content hash iEtXCkNd5XhjNJAOb/wO4IhDRdLIE2CsPxZggZQWJ/q2+sa8dmEPC393nnsiqdH8/4KV8Xn25IzgKPR1UEQ0og==.

    Installed Microsoft.Extensions.DependencyInjection.Abstractions 9.0.10 from https://api.nuget.org/v3/index.json to C:\Users.......................nuget\packages\microsoft.extensions.dependencyinjection.abstractions\9.0.10 with content hash r9waLiOPe9ZF1PvzUT+RDoHvpMmY8MW+lb4lqjYGObwKpnyPMLI3odVvlmshwuZcdoHynsGWOrCPA0hxZ63lIA==.

    Adding package 'Microsoft.Extensions.DependencyInjection.Abstractions.9.0.10' to folder 'C:\Users..............\OneDrive\Documents\VISUAL STUDIO 2022\PROJECTS\WORKSHOP\WINFORMS......................\packages'

    Install failed. Rolling back...

    Package 'Microsoft.Extensions.DependencyInjection.Abstractions.9.0.10 : Microsoft.Bcl.AsyncInterfaces [9.0.10, ), System.Threading.Tasks.Extensions [4.5.4, )' does not exist in project 'HMRCTAX'


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.