Enable-migrations command produces "Could not load file or assembly..." Errors

2

I just migrated my Entity Framework from 5 to 6. Then when i tried to run Enable-Migrations command suddenly i got these errors:

Exception calling "LoadFrom" with "1" argument(s): "Could not load file or 
assembly 'file:///D:\BitBucketGit\packages\EntityFramework.5.0.0\tools
\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. 
Operation is not supported. 

(Exception from HRESULT: 0x80131515)" At D:\BitBucketGit\packages
\EntityFramework.6.1.3\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 D:\BitBucketGit\packages\EntityFramework.6.1.3\tool 
\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:///D:\BitBucketGit\packages\EntityFramework.5.0.0\tools
\EntityFramework.PowerShell.dll' or one of its dependencies. Operation is 
 not supported. (Exception from HRESULT: 0x80131515)"
 At D:\BitBucketGit\packages\EntityFramework.6.1.3\tools
 \EntityFramework.psm1:809 char:5

  +     $domain.CreateInstanceFrom(

  +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

  + FullyQualifiedErrorId : FileLoadException

After googling,some suggested to imply a full trust on the package folder which i did. But the error remains.

Is there any other way i can make it fixed.

cheers,

John

asp.net-mvc-5
ef-migrations
asked on Stack Overflow Mar 31, 2015 by John Hadikusumo

2 Answers

0

Thank for any help. Actually i just found the answer by changing the devenv.exe.config files.

answered on Stack Overflow Mar 31, 2015 by John Hadikusumo
0

Since I pulled the project from a remote server, I solved this issue by removing all contents of packages folder except repositories.config file and restored all NuGet packages.

answered on Stack Overflow Jun 24, 2015 by guneysus

User contributions licensed under CC BY-SA 3.0