2017-09-17 3 views
0

I 부가 마이그레이션을하려고 내가이 오류를 얻을 :추가 마이그레이션 예외에

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. 

이 문제를 해결하는 방법을 알고 않습니다를? 미리 감사드립니다.

P.S : 나는 내가이 오류 메시지가 얻을 관리자 콘솔을 패키지화로 전환 할 때 언급하는 것을 잊었다 :

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 

누군가가 그것을 해결하는 방법을 알고 있나요을? 감사합니다. .

+0

마지막으로 변경 한 사항은 무엇입니까? – ASpirin

+0

Visual Studio 2017에서 마이그레이션을 시도한 것은 처음입니다. –

답변

0

프로젝트에 dll 참조가 제대로없는 것 같습니다.

'Microsoft.Build.Framework, Version = 15.1.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a'또는 해당 종속성 중 하나를로드 할 수 없습니다. 시스템이 지정된 파일을 찾을 수 없습니다. at ...

적절한 dll을 추가하고 솔루션을 정리하고 솔루션을 다시 빌드 한 다음 다시 시도하면 성공적으로 실행해야합니다. 추가 오류가 계속되면 이주 세부 사항을 게시하여보다 잘 이해하고 도움을 받으십시오.

HTH

+0

그래,이 문제에 대해 읽었습니다. https://developercommunity.visualstudio.com/content/problem/25424/error-running-entity-framework-6- 상대 링크가있는 code-first-migrat.html과 나는 그들을 절대적인 변화로 바꾸었다. –

+0

하지만 도움이되지 않았습니다. –