Error on enable-migration

I am new to EF and I have an error when I try to run Enable-Migrations in the PMC console: Exception causing "LoadFrom" with argument "1":

"Could not load file or assembly 'file:///...\pa ckages\EntityFramework.6.0.1\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)" At ...\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:780 char:62 + $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll)) + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException You cannot call a method on a null-valued expression. At ...\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:781 char:50 + $dispatcher = $utilityAssembly.CreateInstance <<<< ( + CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file:///...\packages\EntityFramework.6.0.1\tools\EntityFramework.PowerShell.dll' or one of its dependencies. Operation is no t supported. (Exception from HRESULT: 0x80131515)" At ...\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:809 char:31 + $domain.CreateInstanceFrom <<<< ( + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException 
+6
source share
5 answers

I just ran into this on one of my employees. The solution was:

  • Remove EF NuGet Package
  • Manually remove Entity Framework sections from Web.Config / App.Config files.
  • Close Visual Studio
  • Let's open the solution in Visual Studio
  • Reinstall EF NuGet Package
+5
source

So, open the solutions folder in the file explorer, can you find the DLL files they are looking for in the Packages folder, and then the EntityFramework 6.0.1 folder? If not, there are two options:

  • Check the version control server, it is likely that it was not loaded into the local workspace. if so, just get them manually from the source explorer if you are using TFS.
  • If the files were not on the version control server, I would recommend removing EF 6.0.1 nuget, and then manually deleting the entire ef folder in the Package folder above, and then reinstalling it.
+3
source

I had the same problem. My project was stored on a network drive. There are many security rules that apply to my computer. I moved the project to a local hard drive and the problem was resolved.

It seems that "EntityFramework.Powershell.utility.dll" is being translated to use some powershell functions, and the system prevents these calls from being made, possibly because the DLL that calls powershell is not a local file.

In your case, make sure that you do not have any security policy or system configuration that will prevent your system from performing problematic expansion from a non-local disk (EntityFramework.Powershell.utility.dll)

+1
source

Faced a similar problem. The cause of the problem was the transfer of my code from one machine to another ... Removing and then reinstalling the entity infrastructure made it possible to solve the problem.

+1
source

Update the Entity package from the package manager console or browser.

0
source

Source: https://habr.com/ru/post/973710/


All Articles