Y.Z.
Y.Z.

Reputation: 179

Multiple assemblies with equivalent identity - System.Runtime.dll

I have a MVC6 project with beta-8, when I add the System.Security.Claims nuget package, I’ll get the following compile error:

Error CS1703 Multiple assemblies with equivalent identity have been imported: 'C:\Users\username.dnx\packages\System.Runtime\4.0.20\ref\dotnet\System.Runtime.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\Facades\System.Runtime.dll'. Remove one of the duplicate references.

Any guidance on fixing this issue will be greatly appreciated!

I was able to replicate from just a simple new project, Beta8Class is just a common class library in the solution, here is the project.json:

{
  "webroot": "wwwroot",
  "version": "1.0.0-*",

  "dependencies": {
    "Beta8Class": "1.0.0-*",
    "Microsoft.AspNet.Diagnostics": "1.0.0-beta8",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
    "Microsoft.AspNet.Mvc": "6.0.0-beta8",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta8",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
    "Microsoft.AspNet.StaticFiles": "1.0.0-beta8",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-beta8",
    "Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
    "Microsoft.Framework.Logging": "1.0.0-beta8",
    "Microsoft.Framework.Logging.Console": "1.0.0-beta8",
    "Microsoft.Framework.Logging.Debug": "1.0.0-beta8",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta8",
    "System.Security.Claims": "4.0.1-beta-23409"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  },

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
  }
}

Thanks

Upvotes: 0

Views: 3546

Answers (2)

pg0xC
pg0xC

Reputation: 1266

System.Security.Clamis package version 4.0.1-beta-23409 supports only dnxcore5. Try removing dnx451 target framework.

You may confirm this on NuGet gallery:

https://www.nuget.org/packages/System.Security.Claims/4.0.1-beta-23409

another clue is that your error message says that it searches dotnet folder. I am not yet fully sure how those generator works but this a moniker for core target framework only.

Upvotes: 1

Thom Kiesewetter
Thom Kiesewetter

Reputation: 7334

You get conflicting reference because this is a beta version and mixing two different version will lead to reference conflicts. You should use all beta8 versions.

If you want something with security you can use these packages

    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta8",
    "Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta8",
    "Microsoft.AspNet.Authentication.Google": "1.0.0-beta8",
    "Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta8",
    "Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta8",

Upvotes: 2

Related Questions