C# Mysql与实体框架迁移工具

C# Mysql与实体框架迁移工具,c#,mysql,entity-framework,C#,Mysql,Entity Framework,作为CI实现的一部分,我希望使用Entity Framework 6附带的迁移工具来运行迁移(注意,我不希望自动运行它们) 我的站点的bin文件夹中有迁移工具并运行: 使用\u配置\u type.dll/startupconfigurationfile=“path\u”将程序集\u迁移到\u web.config” 但是,这给了我:错误:“System.Data.Entity.Migrations.DbMigrationsConfiguration”的类型初始值设定项引发了异常。我在命令中指定的

作为CI实现的一部分,我希望使用Entity Framework 6附带的迁移工具来运行迁移(注意,我不希望自动运行它们)

我的站点的bin文件夹中有迁移工具并运行:

使用\u配置\u type.dll/startupconfigurationfile=“path\u”将程序集\u迁移到\u web.config”

但是,这给了我:
错误:“System.Data.Entity.Migrations.DbMigrationsConfiguration”的类型初始值设定项引发了异常。
我在命令中指定的程序集不是MVC web应用程序,而是web应用程序中引用项目的程序集

开始我的配置类:

public class Configuration : DbMigrationsConfiguration<CustomDbContext>
{
    public Configuration()
    {
        AutomaticMigrationsEnabled = false;
        SetSqlGenerator("MySql.Data.MySqlClient", new MySqlMigrationSqlGenerator());  
    }
}
公共类配置:dbmigrionsconfiguration
{
公共配置()
{
AutomaticMiggerationsEnabled=假;
SetSqlGenerator(“MySql.Data.MySqlClient”,新的MySqlMigrationSqlGenerator());
}
}
customdbcontext是一个普通类,在app_start上使用
LocalIocManager.Resolve
解析。不知道发生了什么事