机器迁移连线。

时间:2009-12-07 12:11:17

标签: migration

我一直在尝试连接我的一个项目,以使用Machine.Migrations进行数据库迁移。但是,我无法做到这一点。我一直得到奇怪的错误。我尝试过使用MSBuild任务但收到以下错误。

Target MigrationMachine:
  D:\repositories\core\playground\minhajuddin\MachineMigrationsTest\lib\Machine.Migrations.targets(20,5): error MSB4062: The "Machine.Migrations.MigratorTask" task could not be loaded from the assembly D:\repositories\core\playground\minhajuddin\MachineMigrationsTest\lib\Machine.Migrations.dll. Could not load file or assembly 'file:///D:\repositories\core\playground\minhajuddin\MachineMigrationsTest\lib\Machine.Migrations.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available.
Done building target "MigrationMachine" in project "MachineMigrationsTest.csproj" -- FAILED.

当我尝试使用migrate.exe时。我收到以下错误:

INFO   Compiling Migration<1, CreateEmpTable>System.ArgumentException: Unable to locate Migration: 
D:\repositories\core\playground\minhajuddin\MachineMigrationsTest\MachineMigrationsTest\001_CreateEmpTable.cs    at Machine.Migrations.Services.Impl.MigrationHelpers.LookupMigration(Assembly assembly, MigrationReference migrationReference) in D:\repositories\os\machine.migrations\Source\Machine.Migrations\Services\Impl\BooMigrationFactory.cs:line 80   at Machine.Migrations.Services.Impl.CSharpMigrationFactory.CompileMigration(MigrationReference migrationReference) in D:\repositories\os\machine.migrations\Source\Machine.Migrations\Services\Impl\CSharpMigrationFactory.cs:line 71
   at Machine.Migrations.Services.Impl.AbstractMigrationCompilerFactory.CreateMigrationInstance(MigrationReference migrationReference) in D:\repositories\os\machine.migrations\Source\Machine.Migrations\Services\Impl\AbstractMigrationCompilerFactory.cs:line 9
   at Machine.Migrations.Services.Impl.CSharpMigrationFactory.CreateMigration(Mi
grationReference migrationReference) in D:\repositories\os\machine.migrations\So
urce\Machine.Migrations\Services\Impl\CSharpMigrationFactory.cs:line 35
   at Machine.Migrations.Services.Impl.MigrationRunner.CanMigrate(ICollection`1
steps) in D:\repositories\os\machine.migrations\Source\Machine.Migrations\Servic
es\Impl\MigrationRunner.cs:line 40
   at Machine.Migrations.Services.Impl.Migrator.RunMigrator() in D:\repositories
\os\machine.migrations\Source\Machine.Migrations\Services\Impl\Migrator.cs:line
39
   at Machine.Migrations.Migrator.Run(IConfiguration configuration) in D:\reposi
tories\os\machine.migrations\Source\Machine.Migrations\MigratorTask.cs:line 29
   at Machine.Migrations.ConsoleRunner.Program.Run(String[] args) in D:\reposito
ries\os\machine.migrations\Source\Machine.Migrations.ConsoleRunner\Program.cs:li
ne 38

001_create_emp_table.cs中的代码

namespace MachineMigrationsTest {
    public class CreateEmpTable : SimpleMigration {
        public override void Up() {
            Schema.AddTable("Emp",
                new Column[]
                    {
                        new Column("Id",ColumnType.Long,0,true,false)
                    });
        }

        public override void Down() {
            Schema.DropTable("Emp");
        }
    }


}

请帮帮我。

谢谢你, Khaja Minhajuddin。

1 个答案:

答案 0 :(得分:1)

尝试将您的类命名为与文件相同的名称,但版本为:create_emp_table

编辑:另外,尝试删除命名空间。我认为MMigrations可能要求事物没有命名空间。