System.Data.SqlClient, Version= issues with Asp.Net Core

Today I received the following exception when publishing a site that was working locally for me:


    System.IO.FileLoadException: Could not load file or assembly 'System.Data.SqlClient, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

After trial and erroring for an hour about whether some references I had to the .Net Standard version of System.Data.SqlClient might be causing the issue I decided to go to the remote site, completely delete all the files and re-publish in case there was an old assembly hanging out causing the issue. Sure enough, that fixed the issue. I suspect that during the process of updating NuGet packages that my deploy process left some old assemblies on my site that caused this conflict.

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.