Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After upgrade to 6.3.2: Could not load file or assembly 'Microsoft.Data.SqlClient, Version=1.10.19324.4 #449

Closed
jeroenbu opened this issue Nov 10, 2020 · 3 comments

Comments

@jeroenbu
Copy link

Hi,

I've been stumped by this one: I've upgraded from 6.2.11 to 6.3.2, via NuGet. I'm working on a .NET Framework (4.6.1) C# MVC app. Due to some changes in another dependency I was forced to update my SqlClient to from System.Data.SqlClient to the Microsoft.Data.SqlClient namespace. Following that, I decided to update Insight.Database to 6.3.2.
However, when I do a QuerySQL (probably the first type of connection to my database) i get an error:
"Could not load file or assembly 'Microsoft.Data.SqlClient, Version=1.10.19324.4"
I have in my NuGet Microsoft.Data.SqlClient 2.0.1, can't find any other version on my system. I tried getting earlier versions of this client from NuGet, but the error stayed... Anyone got any clues how I could solve this one?

Thx,

Jeroen

@jeroenbu
Copy link
Author

And perhaps an interesting tidbit: I normally use SqlInsightDbProvider.RegisterProvider().
I tried Insight.Database.Providers.SqlInsightDbProvider.SqlInsightDbProvider.RegisterProvider(), which does give me another error: Cannot derive parameters for the stored procedure spWithSomeCoolName, Have you loaded the provider that supports SqlCommand?

@jeroenbu
Copy link
Author

jeroenbu commented Nov 10, 2020

Got a solution. Apparently was missing this in my web.config:

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.SqlClient" publicKeyToken="23ec7fc2d6eaa4a5" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.20168.4" newVersion="2.0.20168.4" />
      </dependentAssembly>

Added this, and now my application starts.

@jonwagner
Copy link
Owner

For the RegisterProvider issue, see issue #441. I kinda messed that one up. :-/

Insight 6.3 certainly supports Microsoft.Data.SqlClient with Insight.Database.Providers.MsSqlClient.
In 6.3, that's automatically pulled in with the main Insight.Database package.
When you add that package, nuget should automatically include Microsoft.Data.SqlClient and resolve to the latest version of the library.

I updated the HelloWorld sample to run with Microsoft.Data.SqlClient v2.1 and everything seems to work well.

Give it a shot with 6.3.3 without the binding redirect and let me know how it goes.

It seems weird that you have to add the binding redirect. Please reopen this if you want me to look into it more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants