fantastischIdee
fantastischIdee

Reputation: 577

Build error with IdentityModel v3.6.1 and .Net 4.7.2

I was using IntrospectionClient and TokenClient from the IdentityModel v3.6.1.
But when I upgraded the project from .Net 4.7.1 to 4.7.2 I got build errors:

"Error CS0012 The type 'HttpMessageHandler' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

The project is already referencing "System.Net.Http" v4.3.3

Does anyone have an idea wat has changed and what I can do to solve this problem?

Upvotes: 0

Views: 937

Answers (2)

fantastischIdee
fantastischIdee

Reputation: 577

Updating the IdentityModel package to IdentityModel v3.7.0-preview1 helped.

Upvotes: 0

Jose Perez Rodriguez
Jose Perez Rodriguez

Reputation: 266

Are you referencing IdentityModel package using <PackageReference Include=".../>? If so, I believe you might be running into this known issue: https://github.com/Microsoft/dotnet/blob/master/releases/net472/KnownIssues/613745%20-%20Single-name%20references%20are%20removed%20by%20the%20SDK%20when%20targeting%204.7.2.md

Assuming that's the case, can you please try the workaround listed in there which is basically to add to your .csrpoj the following:

<ItemGroup>
  <PackageReference Include="System.Net.Http" Version="4.3.3">
    <ExcludeAssets>All</ExcludeAssets>
  </PackageReference>
</ItemGroup>

I hope that fixes your issue. Also, do note that we are working on a fix on the VisualStudio side so that you won't need this workaround anymore.

Upvotes: 1

Related Questions