我有一个至少有40次迁移的项目。尝试构建一个新的数据库会在其中一个迁移步骤(而不是最后一个)上产生以下错误:
PM> Update-database -ConfigurationTypeName *******.***.Migrations.Configuration
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
Applying explicit migrations: [201501121145515_LocationParentForeignKey, 201501130944127_Part_PartShipmentDocTypeId_Nullable, 201501130949388_PartShipmentDocType_Actibe_RenameTo_Active, 201501130952331_RequestHead_Add_Closed, 201501150844221_Add_Location_SavedFullName].
Applying explicit migration: 201501121145515_LocationParentForeignKey.
System.FormatException: Invalid length for a Base-64 char array or string.
at System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
at System.Convert.FromBase64String(String s)
at System.Data.Entity.Migrations.DbMigration.GetModel(Func`2 modelAccessor)
at System.Data.Entity.Migrations.DbMigration.GetTargetModel()
at System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
at System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration)
at System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClassc.<Update>b__b()
at System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
at System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(String targetMigration)
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.Run()
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Invalid length for a Base-64 char array or string.
每次迁移时只有一个base64编码的字符串,位于标记<data name="Target" xml:space="preserve">
Normally this tag contains a base64 string that can be decoded without a problem. (Contains an edmx file gzipped.)
在失败的迁移中,此标记包含无法解码的字符串。它与实体框架迁移相同: Base-64字符数组或字符串的长度无效。
我现在将尝试重新生成base64字符串,但我将非常感谢您的帮助。
VS 12.0.31101.00更新4 EF 6.1.2-31219