IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Microsoft.IdentityModel.Tokens problem in beta4

Open Tazer opened this issue 10 years ago • 18 comments

Hey ,

Just tried out beta4. But getting this error:

Severity    Code    Description Project File    Line    Suppression State
Error   CS1705  Assembly 'IdentityServer4' with identity 'IdentityServer4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.IdentityModel.Tokens, Version=5.0.0.699, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'Microsoft.IdentityModel.Tokens' with identity 'Microsoft.IdentityModel.Tokens, Version=5.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35'   twee.cloud.auth..NETCoreApp,Version=v1.0    C:\@Project\twee.cloud\twee.cloud.auth\src\Startup.cs   51  Active

my project.json looks like this:

{
  "dependencies": {
    "Dapper": "1.50.0-rc2b",
    "CryptoHelper": "1.0.0-rc2-final",
    "Swashbuckle": "6.0.0-beta9",
    "IdentityServer4": "1.0.0-beta4",
    "StackExchange.Redis": "1.1.604-alpha",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Configuration": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Npgsql": "3.1.4",
    "System.Linq": "4.1.0"
  },

  "tools": {
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "gcServer": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

so not sure why I'm getting that error.

Tazer avatar Jun 27 '16 19:06 Tazer

Noticed it was the same problem in Samples when I opened them. So to reproduces , just open MVC and API.sln and check startup / or try to build:

image

@leastprivilege

Tazer avatar Jun 27 '16 19:06 Tazer

Open our MVC and API sample and compare.

let me know

leastprivilege avatar Jun 27 '16 19:06 leastprivilege

@leastprivilege yes I did and got the same problem :)

C:\@Project\IdentityServer4.Samples\MVC and API\src\IdentityServer\Startup.cs(25,27): error CS1705: Assembly 'IdentityServer4' with identity 'IdentityServer4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.IdentityModel.Tokens, Version=5.0.0.699, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'Microsoft.IdentityModel.Tokens' with identity 'Microsoft.IdentityModel.Tokens, Version=5.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Tazer avatar Jun 27 '16 19:06 Tazer

The Credential verb changed. But that is trivial. This is less so:

error CS1705: Assembly 'IdentityServer4' with identity 'IdentityServer4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.IdentityModel.Tokens, Version=5.0.0.699, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'Microsoft.IdentityModel.Tokens' with identity 'Microsoft.IdentityModel.Tokens, Version=5.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Is it possible that the beta4 package was built against that one "preview versions" nuget server that Microsoft has set up so it either directly or indirectly floats a Microsoft.IdentityModel.Tokens that is newer than the newly released 5.0.0 version?

kmaragon avatar Jun 27 '16 19:06 kmaragon

having a look

leastprivilege avatar Jun 27 '16 19:06 leastprivilege

https://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/

not sure where you have that nuget from - it is def not from us.

Maybe delete your .vs folder and nuget cache

leastprivilege avatar Jun 27 '16 19:06 leastprivilege

Tried that also but no luck. The nuget comes from https://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/ cause it has an dependency on it.

image

Tazer avatar Jun 27 '16 20:06 Tazer

FWIW that error is not a nuget error. It's a dll reference error. So it could be that System.IdentityModel.Tokens.Jwt has a package dependency on the correct package but a dll dependency on the wrong dll... If System.IdentityMode.Tokens.Jwt was in fact the package built (as in compiled) using a nuget repo other than the public one we all use... or just a local cache that used to.

... that said - deleting package cache does no good

As a workaround, we just commented out setting up the certificate for now as we haven't gotten far enough along down the IdentityServer4 path for it to matter yet. Hopefully things will be worked out in the next few days.

kmaragon avatar Jun 27 '16 20:06 kmaragon

I'm getting the same thing. I just installed 2015 Fresh w/ Update 3 & The 1.0.0 Preview 2 SDK. I created an empty Core WebApp and when I started to pull from the example...got the same error.

MasterSkwerl avatar Jun 28 '16 00:06 MasterSkwerl

Same problem here.

ejfn avatar Jun 28 '16 02:06 ejfn

same issue here

etrafiee avatar Jun 28 '16 03:06 etrafiee

Got the same problem as well. This looks like a bug.

avoxm avatar Jun 28 '16 05:06 avoxm

OK - after deleting my package cache I can repro the problem.

Not sure yet what the problem is. working on it.

leastprivilege avatar Jun 28 '16 05:06 leastprivilege

I published beta4-update1 - give it a try

leastprivilege avatar Jun 28 '16 06:06 leastprivilege

It works, thanks!

chrisvfabio avatar Jun 28 '16 06:06 chrisvfabio

thanks

etrafiee avatar Jun 28 '16 07:06 etrafiee

What a quick fix! Thanks.

ejfn avatar Jun 28 '16 10:06 ejfn

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 15 '20 18:01 lock[bot]