I use System.Data.SqlClient Version 4.4.3 for all .NET Standard 2.0 class libraries in my ASP.NET Core 2.0 project. Why do I get
Could not load file or assembly 'System.Data.SqlClient, Version=4.2.0.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
when the project is published with VSTS to Azure App Service? And of course it perfectly works on my machine!
All this worked yesterday. But today I decided to update packages to:
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.3" />
In summary if you get the "Could not load file or assembly error", this means that either your projects or their references were built with a reference to a specific version of an assembly which is missing from your bin directory or GAC.
The Microsoft. Data. SqlClient API details can be found in the . NET API Browser.
Represents a set of data commands and a database connection that are used to fill the DataSet and update a SQL Server database. This class cannot be inherited.
Don't know whether this is the same situation that I faced. I added System.Data.SqlClient via nuGet and it worked fine.
Downgraded to
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
and everything works again! Lost 4 hours today!!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With