Infrastucture does not exist in System.Data.Entity

12,008

S̶o̶ ̶I̶ ̶m̶a̶n̶u̶a̶l̶y̶ ̶a̶d̶d̶e̶d̶ ̶f̶i̶l̶e̶ ̶S̶e̶r̶i̶a̶l̶T̶r̶a̶c̶k̶e̶r̶.̶t̶t̶ ̶t̶o̶ ̶S̶e̶r̶i̶a̶l̶T̶r̶a̶c̶k̶e̶r̶.̶e̶d̶m̶x̶.̶
T̶h̶i̶s̶ ̶f̶i̶l̶e̶ ̶I̶ ̶c̶o̶p̶i̶e̶d̶ ̶f̶r̶o̶m̶ ̶a̶n̶o̶t̶h̶e̶r̶ ̶p̶r̶o̶j̶e̶c̶t̶.̶
N̶o̶w̶ ̶i̶s̶ ̶p̶r̶o̶j̶e̶c̶t̶ ̶g̶e̶n̶e̶r̶a̶t̶e̶ ̶e̶n̶t̶i̶t̶i̶e̶s̶ ̶R̶i̶g̶h̶t̶.̶

EDIT (04-29-2014):
Renewed answer:
You can delete file *.tt and recreate it with
Add -> New Item -> EF 5.x DbContextGenerator (or EF 6.x ...)

Share:
12,008
Gh61
Author by

Gh61

Updated on June 04, 2022

Comments

  • Gh61
    Gh61 almost 2 years

    I am trying to create MVC project with Entity Framework. I have 3 Projects in Solution

    • SerialTracker.Common
    • SerialTracker.Model
    • SerialTracker.Web

    Common and Model are compiled like library, so Web is using them. Model is also using Common.

    My probelm is here:

    Model generate from *.edmx ==> *.Context.tt ==> whitch auto generates *.Context.cs:

    namespace SerialTracker.Model
    {
        using System;
        using System.Data.Entity;
        using System.Data.Entity.Infrastructure;
    
        public partial class SerialTrackerEntities : DbContext
        {
            public SerialTrackerEntities()
                : base("name=SerialTrackerEntities")
            {
            }
    
            protected override void OnModelCreating(DbModelBuilder modelBuilder)
            {
                throw new UnintentionalCodeFirstException();
            }
    
            public DbSet<Role> Role { get; set; }
            public DbSet<User> User { get; set; }
        }
    }
    

    I have error, that Infrastucture does not exist in System.Data.Entity. I tried adding some References, but i think the problem is in another place.

    //EDIT: I reinstaled NuGet package for this project, but now i have error and doesn't exist

    Sorry for my poor English.