2017-09-17 1 views
0

Wenn ich versuche, Migration zu Add-ich bekomme diese Fehlermeldung:Add-Migration Exeception

PM> add-migration RestrictPromotionContentAndTitle 
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 
     at BrightInfo.Infrastructure.Settings.DbAudit.AuditDbContext..ctor(String connString) 
     at BrightInfo.Infrastructure.Settings.BrightInfoContext..ctor(Boolean proxyCreationEnabled, Boolean lazyLoadingEnabled) in C:\Projects\BrightInfo\BrightInfo.Infrastructure.Settings\BrightInfoContext.cs:line 124 
     at BrightInfo.Infrastructure.Settings.BrightInfoContext..ctor() in C:\Projects\BrightInfo\BrightInfo.Infrastructure.Settings\BrightInfoContext.cs:line 113 
     --- End of inner exception stack trace --- 
     at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) 
     at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) 
     at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) 
     at System.Activator.CreateInstance(Type type, Boolean nonPublic) 
     at System.Activator.CreateInstance(Type type) 
     at System.Data.Entity.Infrastructure.DbContextInfo.<CreateActivator>b__0() 
     at System.Data.Entity.Infrastructure.DbContextInfo..ctor(Type contextType, DbProviderInfo modelProviderInfo, AppConfig config, DbConnectionInfo connectionInfo) 
     at System.Data.Entity.Infrastructure.DbContextInfo..ctor(Type contextType) 
     at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext) 
     at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration) 
     at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator() 
     at System.Data.Entity.Migrations.Design.ToolingFacade.GetPendingMigrationsRunner.RunCore() 
     at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run() 
    Exception has been thrown by the target of an invocation. 

Wer weiß, wie dieses Problem zu beheben? Vielen Dank im Voraus.

P. S .: Ich habe vergessen zu erwähnen, wenn ich Manager-Konsole Paket wechseln erhalte ich diese Fehlermeldung:

Unable to find type [NuGet.PackageManager]. Make sure that the assembly that contains this type is loaded. 
At C:\Projects\BrightInfo\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1:4 char:5 
+ if ([NuGet.PackageManager].Assembly.GetName().Version -lt 1.4) 
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : InvalidOperation: (NuGet.PackageManager:TypeName) [], RuntimeException 
    + FullyQualifiedErrorId : TypeNotFound 

jemand Kennt wie man es beheben? Danke.

+0

Was war die letzte Änderung, die Sie vorgenommen haben? – ASpirin

+0

Es ist das erste Mal, wenn ich versuche, in Visual Studio 2017 zu migrieren. –

Antwort

0

Scheint so, als ob Sie in Ihrem Projekt keine DLL-Referenz korrekt haben.

Datei oder Assembly konnte nicht geladen werden 'Microsoft.Build.Framework, Version = 15.1.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a' oder eine seiner Abhängigkeiten. Die angegebene Datei wurde vom System nicht gefunden. bei ...

Wenn Sie die entsprechende dll und saubere Lösung hinzufügen können, erstellen Sie die Lösung neu und versuchen Sie es erneut, sollten Sie erfolgreich ausgeführt werden. Wenn weitere Fehler weiterhin auftreten, posten Sie Ihre gefundenen Migrationsdetails, um sie besser zu verstehen und Ihnen zu helfen.

HTH

+0

Ja, ich habe über dieses Problem gelesen https://developercommunity.visualstudio.com/content/problem/25424/error-running-entity-framework-6- code-first-migrat.html mit relativer Verknüpfung und ich habe sie in absolute Pfade geändert. –

+0

Aber es hat nicht geholfen. –

Verwandte Themen