2016-05-27 8 views
0

を使用して、ターゲットプロジェクト 'xxx'がマイグレーションアセンブリ 'xxx'と一致しません。アセンブリ内の2番目のDBContextの移行クラスを構築しようとしています。 Add-Migration AlertInitial -c Axper.Data.Persistence.Context.AlertContext と「パッケージコンソール管理」を使用してMigrate "aspnet Core 1.0 RC2 -

をしかし、それは失敗し、私は、このエラーを与える:このコマンドを使用して

Your target project 'AxPortal' doesn't match your migrations assembly 'Axper.Data.Persistence'. 
Either change your target project or change your migrations assembly. Change your migrations assembly by using DbContextOptionsBuilder. E.g. options.UseSqlServer(connection, b => b.MigrationsAssembly("AxPortal")). 
By default, the migrations assembly is the assembly containing the DbContext. 

Change your target project to the migrations project by using the Package Manager Console's Default project drop-down list, or by executing "dotnet ef" from the directory containing the migrations project. 

私はこのエラーが何を意味するか理解できない、と何をすべきか修正しますそれ。 誰かを助けることができますか?

+0

私はしたいが、マイグレーションクラスを保持するプロジェクトでは、クラスライブラリです。 RC2以降、クラスライブラリはまだサポートされていません。 – Hugo

答えて

0

不明な理由により、私のプロジェクト/ソリューションフォルダが壊れていました。私は私を削除し、Gitリポジトリを再クローンしました。ついに私は移行を実行することができました。

0

options.UseSqlServer(connection, b => b.MigrationsAssembly("WebApplication3")). By default, the migrations assembly is the assembly containing the DbContext.

services.AddDbContext<ComDbContext>(options => 
      { 
       options.UseSqlServer("server=.\\sqlexpress;database=dsafdsaf;uid=sa;pwd=123456", b => b.MigrationsAssembly("WebApplication3")); 
      }); 
関連する問題