I try to use the IdentityModel package in the .NET Core class library, but I have a conflict between netstandardand System.Net.Http:
error CS0433: The type 'HttpClient' exists in both
'System.Net.Http, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and
'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IdentityModel" Version="2.8.1" />
</ItemGroup>
</Project>
By default Class1.cs:
using System;
using System.Net.Http;
namespace Test
{
public class Class1
{
HttpClient client = new HttpClient();
public Class1() {}
}
}
What is the right way to solve this problem?
source
share