2016-05-27 7 views
0

Ich versuche, die Migrationsklassen für einen zweiten DBContext in einer Assembly zu erstellen. mit diesem Befehl: Add-Migration AlertInitial -c Axper.Data.Persistence.Context.AlertContext und das „Package Console Management“Migration "unser Zielprojekt 'xxx' stimmt nicht mit Ihrer Migrationsassembly 'xxx'" unter Verwendung von aspnet Core 1.0 überein RC2 -

Aber es nicht und geben Sie mir diesen Fehler mit:

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. 

Ich kann nicht verstehen, was diese Fehler bedeuten, und was zu tun zu beheben es. Kann jemand helfen?

+0

Ich mag, aber das Projekt, das die Migration Klasse halten, ist eine Klassenbibliothek. Und seit RC2 wird die Klassenbibliothek noch nicht unterstützt. – Hugo

Antwort

0

Aus unbekannten Gründen war mein Projekte/Solution-Ordner irgendwie beschädigt. Ich habe I gelöscht und das Git Repository neu geklont. Endlich konnte ich die Migration machen.

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")); 
      });