Could not load type 'System.ComponentModel.DataAnnotations.Schema.IndexAttribute'
c#, data-annotations, dbcontext, entity-framework
Solution
Edit your `.csproj` file, and replace the `<HintPath>` values with the correct Entity Framework version paths (currently, the latest stable version is 6.1.2):
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.6.1.2\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.6.1.2\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
Verify that the paths exist; if not, install the Nuget package for the version you want.
To be clear, these are the `<HintPath>` elements you want to edit to ensure have the current version:
<HintPath>..\packages\EntityFramework.6.1.2\lib\net45\EntityFramework.dll</HintPath>
and
<HintPath>..\packages\EntityFramework.6.1.2\lib\net45\EntityFramework.dll</HintPath>
Leave these set to the major version 6.0.0.0:
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
And
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
Problem
I am having this Error. The ApplicationDbContext is Auto Generated DbContext, used in account section. Whenever i try to use any Account Controller actions this error occurs. The error originates from ``` public AccountController() : this(new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()))) { } ``` I have my own DbContext which works fine and gets all the required Data. The references are fine. How do i fix this issue. Update I used some updated Refrences for AspNet.Identity . is it causing the issue? Update 2 This error occured when I was mixing two Membership provider versions. I first used the default provided with MVC 5 then tried to use MVC 3 membership, then again went back to MVC 5. Then this error started to pop up. I still have not found the solution to this problem. But as workaround, I recreated the Project will all my previous files, and it worked.