C# – Entity Framework 4.3 migrations error

centity-frameworkentity-framework-4

I've just installed EF 4.3-beta1 for the migrations goodness, and I can't get it working. The error I get:

PM> Update-Database -Verbose
Using NuGet project 'Project.Domain'.
Using StartUp project 'ProjectWebSite'.
System.InvalidOperationException: No migrations configuration type was found in the assembly 'Project.Domain'.
   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindConfiguration()
   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
   at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
No migrations configuration type was found in the assembly 'Project.Domain'.

I've added a new column to 2 EF classes:

public class MasterInstance
{
    public int MasterInstanceId { get; set; }
    [Required] public string HostName { get; set; }
    [Required] public string Name { get; set; } /* <-- THIS IS NEW */
    [Required] public string ConnectionString { get; set; }
    public virtual ICollection<MasterInstanceLocation> MasterInstanceLocations { get; set; }
}

And my DbContext looks like this:

public class ProjectDontext: DbContext, IProjectContext
{
    public IDbSet<Installer> Installers { get; set; }
    public IDbSet<MasterInstance> MasterInstances { get; set; }
    public IDbSet<MasterInstanceLocation> MasterInstanceLocations { get; set; }
}

Any ideas? My EF classes & context live in a separate assembly (Project.Domain). I've tried running the update-database in the context of both the main website and the domain project, and I get the same error either way.

EDIT

Solution found. It turns out, that you need to enable migrations for your project. You can do this by running Enable-Migrations in the NuGet console (make sure you have the right project selected – for me this was the project.domain project).

This walkthrough provides more information

Best Answer

Solution found. It turns out, that you need to enable migrations for your project. You can do this by running Enable-Migrations in the NuGet console (make sure you have the right project selected - for me this was the project.domain project).

This walkthrough provides more information