Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Error: Could not load type 'System.ComponentModel.DataAnnotations.Schema.IndexAttribute' from assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

$
0
0

I got an issue trying to set up Asp.Net Identity 2.1 with MVC5 and have installed the entity Framework 6.1.2 libraries. But when I run the application and try and get this to for example register a user I get the following error;

Could not load type 'System.ComponentModel.DataAnnotations.Schema.IndexAttribute' from assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

[TypeLoadException: Could not load type 'System.ComponentModel.DataAnnotations.Schema.IndexAttribute' from assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]    Microsoft.AspNet.Identity.EntityFramework.IdentityDbContext`6.OnModelCreating(DbModelBuilder modelBuilder) +0    System.Data.Entity.Internal.LazyInternalContext.CreateModelBuilder() +375    System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +15    System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +123    System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +602    System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18    System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +53    System.Data.Entity.Internal.Linq.InternalSet`1.Include(String path) +18    System.Data.Entity.Infrastructure.DbQuery`1.Include(String path) +66    System.Data.Entity.QueryableExtensions.Include(IQueryable`1 source, String path) +130    System.Data.Entity.QueryableExtensions.Include(IQueryable`1 source, Expression`1 path) +181    Microsoft.AspNet.Identity.EntityFramework.UserStore`6.GetUserAggregateAsync(Expression`1 filter) +609    Microsoft.AspNet.Identity.EntityFramework.UserStore`6.FindByNameAsync(String userName) +1072    Microsoft.AspNet.Identity.UserManager`2.FindByNameAsync(String userName) +178    Microsoft.AspNet.Identity.Owin.<PasswordSignInAsync>d__29.MoveNext() +217    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24    TestID.Controllers.<Login>d__2.MoveNext() in f:\CodeSamples\IDClaims\TestID\TestID\Controllers\AccountController.cs:78    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52    System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21    System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +61    System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +114    System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) +66    System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)+49    System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +117    System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +323    System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +44    System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50    System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +72    System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185    System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40    System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40    System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44    System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +39    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)+62    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40    System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39    System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39    System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+9657896    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

The error indicates that I am using Entity Framework Version 6.0.0 which has a feature only available in Version 6.1 onwards. I have checked my project references and all my references point to Version 6.1.2, not sure what I am doing wrong?

I have installed Visual Studio Update 4 and Web Essentials 2013 and regardless if I set up a new project I get the same issue. I have reinstalled the nuget packages through the command line a number of times and have cleared out my cache from the following directory;

Delete all files from the following folders and try again:

C:\Users\[username]\AppData\Local\Temp\Temporary ASP.NET Files\ %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\ %SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\ %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\ %SystemRoot%\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\

But still get the same problem, I am using ASP.Net Identity 2.1.0 and Entity Framework 6.1.2 and package.config point to the correct versions and references point to the correct package directory and project references point to the correct reference directory of Entity 6.1.2. emmm.....

Even if I go into Object Browser I can see the IndexAttribute method in the System.ComponentModel.Data.Annotation.Schema.

One thing that does look odd to me is that in .NET Reflector Object Browser the Entity Framework assembly looks like 6.0.0.0 not sure why when all references are looking at 6.1.2.

Any assistance would be appreciated. :O)


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>