After upgrading from ASP.NET Core 2.0 to 2.1-preview2 I got the following error:
Error CS1705 Assembly 'System.Data.SqlClient' with identity 'System.Data.SqlClient, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' uses 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
When I look around for similar errors, I see a lot of discussions about the versions that are referenced in csproj or json files (depending how old the discussion is). But in .NET Core there is only one reference to Microsoft.AspNetCore.App
. So, I don't have any way to manipulate the references to either System.Data.SqlClient
or System.Runtime
Another observation that while most errors refer to real code like connection.Open()
there are two references to non-existent file CSC line 1.
UPDATE: if I create a new project and copy the offending code there, I am not getting any errors. So, apparently the references to the mismatching versions are somewhere in the project... but I can't figure out where!
This error indicates that there is a version mismatch between what is referenced by the assembly (<Y.Y.Y.Y>) and what the project is pointed towards (<Z.Z.Z.Z>). To correct this, you need to re-add the correct reference in Solution Explorer. Confirm that the DLL version <Y.Y.Y.Y> is present on your computer.
Step 1 : Run visual studio command prompt and go to directory where your DLL located. Step 2 : Now create il file using below command. Step 3 : Generate new Key for sign your project. Step 4 : Now sign your library using ilasm command.
Had the same issue. Resolved by locating RuntimeFrameworkVersion tag in .csproj file and changing it's value to 2.1.
Using Visual Studio, the easiest way is:
1.- Right-click on the solution and go to "Manager Nugget Packages for solution..."
2.- Go to "Consolidate tab" (The last on the right side) You will see the different versions of assemblies on each project.
Good Luck!!
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