2014-11-26 1 views
1

Entity Framework를 사용하여 ASP.NET MVC5에 대해 배우고 있습니다.ASP.NET MVC Nuget Enabling-Migrations

Enable-Migrations -ContextType ApplicationDbContext Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///C:...\Projects\Lynda MVC - Exercise Files\Ch3 - continue\Start\packages\EntityFramework.6.1.1\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)" At C:...\Projects\Lynda MVC - Exercise Files\Ch3 - continue\Start\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:780 char:5 + $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsP ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : FileLoadException You cannot call a method on a null-valued expression. At C:...\Projects\Lynda MVC - Exercise Files\Ch3 - continue\Start\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:781 char:5 + $dispatcher = $utilityAssembly.CreateInstance( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file:///C:...\Projects\Lynda MVC - Exercise Files\Ch3 - continue\Start\packages\EntityFramework.6.1.1\tools\EntityFramework.PowerShell.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)" At C:...\Projects\Lynda MVC - Exercise Files\Ch3 - continue\Start\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:809 char:5 + $domain.CreateInstanceFrom( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : FileLoadException

: 나는 그것을 내가 folowin 오류가 발생했습니다 실행 한 후

Enable-Migrations -ContextType ApplicationDbContext 

: 다음 코드를 실행하기 위해 내가 어디로 내 학습을 위해 나는 린다 비디오 자습서를 사용하고 있는데 나는이 Nuget 콘솔에 붙어

어떤 해결책으로도 도움을받을 수 있다면 큰 도움이 될 것입니다.

+0

가능한 복제본 [EF 4.3.1에서 마이그레이션을 가능하게하려고 시도했을 때 예외가 발생했습니다.] (http://stackoverflow.com/questions/10999561/exception-raised-when-im-trying-enable-migrations-in -ef-4-3-1) – markpsmith

답변

3

'-ContextTypeName switch instead, and specify your DBContext` 클래스를 사용하십시오. 즉,보다 유용한 스위치

Enable-Migrations -ContextTypeName Someproject.DepartmentDb 

, 나는이 같은 문제가 있었다 THIS

+0

링크를위한 Thx 몇 가지 조합을 시도하고 내가 붙어 있다면 회신 할 것입니다. – djpetrovic

0

를 참조하십시오. 내 프로젝트가 네트워크 드라이브에 저장되었습니다. 내 PC에는 많은 보안 정책이 적용됩니다. 프로젝트를 로컬 하드 드라이브로 옮겼습니다. 문제가 해결되었습니다.

"PowerShell을 호출하는 DLL이 로컬 파일이 아니기 때문에"EntityFramework.Powershell.utility.dll "이 일부 powershell 기능을 사용하는 것처럼 보이며 시스템이 이러한 호출을 실행하지 못하는 것 같습니다.

경우에 따라 시스템에서 문제가있는 확장 (EntityFramework.Powershell.utility.dll)을 호출하지 못하도록하는 보안 정책이나 시스템 구성이 없는지 확인하십시오.