Microsoft.Data.SqlClient is upgraded to 5.1.5

Prithivirajan Anbalagan 0 Reputation points
2024-08-09T15:17:04.3333333+00:00

I have upgraded Microsoft.Data.SqlClient to version 5.1.5 and deployed it on the server. However, the application encountered an error stating "Could not load file or assembly 'Microsoft.Data.SqlClient, Version=1.0.19239.1'". I have checked for Microsoft.Data.SqlClient version on the server in the bin folder, GAC path, and Asp Net temp folder, and confirmed that the available version is 5.1.5. Despite this, the application is still trying to find the older version specified as 1.0.19239.1.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,912 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 54,806 Reputation points
    2024-08-09T16:12:17.4566667+00:00

    Sounds like you have a dependency that is looking for SqlClient v1.0. You didn't mention the type of app you're having. I assume it is a web app but not sure whether you're using NET Framework or NET 6/8. For NET Framework look in your web.config file and ensure you have a binding redirect for SqlClient that points to the 5.1.5 version. This will resolve the issue.

    For NET 6/8 the binding redirect should not be an issue.

    Ensure all your dependencies have been updated as well. Furthermore use the Consolidation tab in NuGet Package Manager UX for the solution to ensure you don't have any version conflicts.


  2. Prithivirajan Anbalagan 0 Reputation points
    2024-08-23T08:38:00.97+00:00

    I have attached the web.config file to resolve my issue.WebConfig.txt


Your answer

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