Compiler Errors after updating Microsoft.Aspnet.Id

2019-05-25 06:45发布

Using the Vs2013 preview, i created a c# webapp selecting MVC and WebAPI from the dialog. It compiled ok. If i update the references from the nuget package manager to the beta2 versions (include Prerelease), it then fails to compile. I get 21 errors, located in the AccountController.cs and the IdentityConfig.cs. I tried updateing to the latest nightly libraries which gave the same errors. Appreciate preview code is just that so start again from the template. Was wondering if anyone knew which reference i could avoid updating.

Error 1 The call is ambiguous between the following methods or properties: 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' and 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\Controllers\AccountController.cs 115 29 vs2013bootstrap Error 2 The call is ambiguous between the following methods or properties: 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' and 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\Controllers\AccountController.cs 138 64 vs2013bootstrap Error 3 The call is ambiguous between the following methods or properties: 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' and 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\Controllers\AccountController.cs 151 29 vs2013bootstrap Error 4 The call is ambiguous between the following methods or properties: 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' and 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\Controllers\AccountController.cs 152 64 vs2013bootstrap Error 5 The call is ambiguous between the following methods or properties: 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserName(System.Security.Principal.IIdentity)' and 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserName(System.Security.Principal.IIdentity)' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\Controllers\AccountController.cs 185 41 vs2013bootstrap Error 6 The call is ambiguous between the following methods or properties: 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' and 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\Controllers\AccountController.cs 249 52 vs2013bootstrap Error 7 The call is ambiguous between the following methods or properties: 'Microsoft.AspNet.Identity.IdentityExtensions.FindFirstValue(System.Security.Claims.ClaimsIdentity, string)' and 'Microsoft.AspNet.Identity.IdentityExtensions.FindFirstValue(System.Security.Claims.ClaimsIdentity, string)' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\Controllers\AccountController.cs 286 86 vs2013bootstrap Error 8 The call is ambiguous between the following methods or properties: 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' and 'Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(System.Security.Principal.IIdentity)' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\Controllers\AccountController.cs 338 61 vs2013bootstrap Error 9 'Microsoft.AspNet.Identity.IUserSecretStore' does not contain a definition for 'UpdateSecret' and no extension method 'UpdateSecret' accepting a first argument of type 'Microsoft.AspNet.Identity.IUserSecretStore' could be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\Controllers\AccountController.cs 376 57 vs2013bootstrap Error 10 Metadata file 'C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\bin\vs2013bootstrap.dll' could not be found C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap.Tests\CSC vs2013bootstrap.Tests Error 11 The type or namespace name 'DbContextFactory' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\App_Start\IdentityConfig.cs 32 40 vs2013bootstrap Error 12 'UserSecret' is an ambiguous reference between 'Microsoft.AspNet.Identity.EntityFramework.UserSecret' and 'vs2013bootstrap.Models.UserSecret' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\App_Start\IdentityConfig.cs 33 45 vs2013bootstrap Error 13 The type or namespace name 'EFUserSecretStore' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\App_Start\IdentityConfig.cs 33 27 vs2013bootstrap Error 14 'UserLogin' is an ambiguous reference between 'Microsoft.AspNet.Identity.EntityFramework.UserLogin' and 'vs2013bootstrap.Models.UserLogin' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\App_Start\IdentityConfig.cs 34 43 vs2013bootstrap Error 15 The type or namespace name 'EFUserLoginStore' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\App_Start\IdentityConfig.cs 34 26 vs2013bootstrap Error 16 'User' is an ambiguous reference between 'Microsoft.AspNet.Identity.EntityFramework.User' and 'vs2013bootstrap.Models.User' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\App_Start\IdentityConfig.cs 35 37 vs2013bootstrap Error 17 The type or namespace name 'EFUserStore' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\App_Start\IdentityConfig.cs 35 25 vs2013bootstrap Error 18 'Role' is an ambiguous reference between 'Microsoft.AspNet.Identity.EntityFramework.Role' and 'vs2013bootstrap.Models.Role' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\App_Start\IdentityConfig.cs 36 37 vs2013bootstrap Error 19 'UserRole' is an ambiguous reference between 'Microsoft.AspNet.Identity.EntityFramework.UserRole' and 'vs2013bootstrap.Models.UserRole' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\App_Start\IdentityConfig.cs 36 43 vs2013bootstrap Error 20 The type or namespace name 'EFRoleStore' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\App_Start\IdentityConfig.cs 36 25 vs2013bootstrap Error 21 The call is ambiguous between the following methods or properties: 'Microsoft.AspNet.Identity.IdentityExtensions.FindFirstValue(System.Security.Claims.ClaimsIdentity, string)' and 'Microsoft.AspNet.Identity.IdentityExtensions.FindFirstValue(System.Security.Claims.ClaimsIdentity, string)' C:\Users\Administrator\Documents\Visual Studio 2013\Projects\vs2013bootstrap\vs2013bootstrap\App_Start\IdentityConfig.cs 95 24 vs2013bootstrap

UPDATE If i start from scratch with the same template, and update just the MVC and the WEBAPI libraries to 5.0.0-beta2 (or 3.0.3-beta2 in the case of Razor). then my application still compiles. The updates which i havent applied are those which are all stamped with 1.1.0-beta2 and are named starting Microsoft.Owin.Security

UPDATE2 if i then add all the Owin security references it still compiles. Leaving two libraries

  • Microsoft.Aspnet.Identity.Core which is currently 1.0.0-Alpha1 (update is 1.0.0-Beta1)
  • Microsoft.AspNet.Identity.EntityFramework which is currently 1.0.0-Alpha1 (update 1.0.0-beta1).

If i update the first library i get the above bold error, if i then update the second i get all the other errors.

So appears these updates aren't compatible with the other beta updates.

1条回答
何必那么认真
2楼-- · 2019-05-25 07:27

Think i have finally found the resource which answers this. There is an asp.net/vs2013 refresh which updates the templates to the beta preview of Identity and removes the breaking changes

查看更多
登录 后发表回答