beewest
beewest

Reputation: 4846

Could not load file or assembly 'Microsoft.IdentityModel.Tokens, Version=5.2.0.0

I am trying to add OWIN JWT into webapi project using VS 2015. The reference shows Microsoft.Owin.Security.Jwt, Version=4.0.0.0 and Microsoft.IdentityModel.Tokens Version=5.3.0.0. Below is the error when running. I could not find 5.2.0.0 in the source code.

=== Pre-bind state information ===
LOG: DisplayName = Microsoft.IdentityModel.Tokens, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///C:/Users/xxx/Documents/xxx/WebApi/
LOG: Initial PrivatePath = C:\Users\xxx\Documents\xxx\WebApi\bin
Calling assembly : Microsoft.Owin.Security.Jwt, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.

Any idea please?

Upvotes: 7

Views: 23256

Answers (3)

Venugopal D
Venugopal D

Reputation: 1

Just Go through this. It may be helpful.

Solved it by adding a line of code in the .csproj file.

<PropertyGroup>
    <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>

Could not load file or assembly Microsoft.IdentityModel.Tokens problem

Upvotes: 0

ddagsan
ddagsan

Reputation: 1826

I removed all packages in solution that related *.Owin and install same version again.

Upvotes: -1

AbuDawood Oussama
AbuDawood Oussama

Reputation: 923

First, you should understand that the exception occurred is not restricted to Microsoft.IdentityModel.Tokens assembly, nor the Visual Studio Version. the problem is popular with the assembly referencing.

the popular reason is: you are referencing in the project to a version different than in the "DLL" package used in the execution (bin folder). However, I think this farther than getting happened manually.

1- I can guess based on the assembly name. that you have more than one project in your solution and you lastly installed the assembly using NuGet with a version higher than in other projects (of course using NuGet )

Try to verify the installed package in all your projects and update all of them to the latest one Version=5.3.0.0.

Another potential reason is: this package requires the Microsoft.IdentityModel.Logging try to do the same operation explained above in point 1.

Upvotes: 7

Related Questions