Ambiguous reference issue (Microsoft.AspNet.Identi

2019-01-28 11:11发布

问题:

I'm building an AngularJS Single-Page App using the latest VS2015 Community and ASP.NET 5 etc...

The problem I'm now having while trying to implement an Authentication is that I need to use these two Namespaces:

Microsoft.AspNet.Identity //Version 3.0.0-beta4
Microsoft.AspNet.Identity.Owin //Version 2.2.1

but since Microsoft.AspNet.Identity.Owin has a dependency with

Microsoft.AspNet.Identity.Core 

I keep getting ambiguous reference issues, for example for UserManager which exists in both Microsoft.AspNet.Identity and Microsoft.AspNet.Identity.Core .

Has anyone else dealt with this before? Is it a version incompatibility issue or just the not complete Owin ASP.NET 5 implementation?

回答1:

The Microsoft.AspNet.Identity.Owin package is part of ASP.NET Identity 2, not the newest version shipped with ASP.NET 5. Trying to reference it will download ASP.NET Identity 2 and cause the weird error you're experiencing.

Just reference Microsoft.AspNet.Identity and it should work.