Search code examples
c#xamarin.forms.net-coreportable-class-library

C# - .net core - Assembly which has a higher version than referenced assembly


I've created a .net core class library which use ADO.net technology .
Used library : System.Data.SqlClient version 4.4.3 from nuget

it works ok in .netcore console application . But, when i use it with Xamarin forms PCL it occurs the following error :

Severity Code Description Project File Line Suppression State Error CS1705 Assembly 'xxx' with identity 'xxx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

I tried to update System.Runtime library separately but result is the same .
How to fix this problem ?


Solution

  • The PCL projects rely on a selected API surface (the profile). System.Data.SqlClient however, according to NuGet, does not support any PCL surface but only .NET Standard and various other SDKs. Change your shared library to a .NET Standard one, and the library should work.