update-database
을 다른 컴퓨터에서 실행되는 Entity Framework 5 프로젝트에서 실행하려고합니다. Entity Framework 마이그레이션을 디버깅하는 방법 LoaderExceptions?
update-database
을 실행할 때 나는 다음과 같은 오류가 발생합니다 :
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindType[TBase](String typeName, Func`2 filter, Func`2 noType, Func`3 multipleTypes, Func`3 noTypeWithName, Func`3 multipleTypesWithName)
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindConfiguration()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
내가 어떤 어셈블리가 내 환경에 없기 때문에이 오류가 발생한다고 가정, 아니면 때문에 호환되지 않는 어셈블리가 GAC에서 발견되었습니다. 그러나 타입이로드에 실패했음을 알았으므로 어둠에 빠져서 디버깅하기가 매우 어렵습니다.
로드 할 수없는 유형 또는 어셈블리를 어떻게 알 수 있습니까? 이 메시지는 "LoaderExceptions 속성을 검색하여 자세한 정보를 얻습니다."라는 메시지가 표시되지만 마이그레이션은 패키지 관리자 콘솔에서 실행되며 사용자 코드에서는 수행되지 않습니다.
콘솔에 $Error[0].Exception
을 입력하면 예외 메시지가 표시되지만 다른 속성은 어떻게 나열 할 수 있습니까? 이 당신을 도울하지만, 단지 아이디어를 던져 수 있다면
예외를 System.Reflection.ReflectionTypeLoadException에 캐스팅하고 LoaderExceptions 속성에 액세스하려고 했습니까? – user1908061
@ user1908061 아니, 어디에서해야합니까? PowerShell 명령 줄에서? 수업 파일에? 방법? 이것은 대답 일 수 있습니다.이 경우 좀 더 자세하게 답변을 게시하면 감사하겠습니다. –
'$ Error [0] .Exception'으로했던 것처럼 콘솔에 타이핑하지만, 이번에는 Exception을 올바른 타입으로 캐스팅하고 정확한 문제에 관한 더 많은 정보를 얻기 위해'LoaderExceptions' 속성에 접근합니다. 그러나 당신이 이미 문제를 해결했기 때문에 기쁩니다. :-) – user1908061