Using NetCore 3.1 Class library in Xamarin

yahya sevikoğlu 46 Reputation points
2021-11-03T15:24:03.89+00:00

Hello Everyone,

We have a very big class library which is developed using netcore 3.1

We can perfectly communicate with other desktop apps using this API and now We want to support mobile devices too.
We are using Xamarin netstandard 2.0. We can add reference to our dll file with no error but when the mobile application starts running it throws this exception if any method in dll is called in the app:

System.TypeLoadException: 'Could not resolve type with token 0100004b from typeref (expected class 'System.Threading.Tasks.Task' in assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')'

But it doesnt throw an exception if the dll is added to project but not used.

We tried to switch to net 5 but didnt work out.

How can I solve this issue?

thanks.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,396 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,278 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lex Li (Microsoft) 4,742 Reputation points Microsoft Employee
    2021-11-04T05:45:18.67+00:00

0 additional answers

Sort by: Most helpful