1

I have checked extensively for a solution to the below error to no avail.

When opening Package Manager Console in Visual Studio, I receive an error stating that "There was an error in loading the format data file.. Path --> to file" cannot be loaded because its execution is blocked by software restriction policies. For more information contact your administrator.

These are all of the things i've done to correct but failed.

  1. Running Powershell as an Administrator.. I Set-ExecutionPolicy to RemoteSigned and Unrestricted in powershell(x86), powershell ISE (x86) and also both 64bit versions..

  2. Running Powershell as an Administrator.. I Set ExecutionPolicy -scope for process, currentuser and localmachine to RemoteSigned and Unrestricted.

  3. Reinstalled Visual Studio.

  4. Set the ExecutionPolicy in Registry Editor to RemoteSigned and Unrestricted.

But I am still getting the error.. Can someone please help..

Thanks

digiShadoe
  • 117
  • 5
  • 15

2 Answers2

1

Let me know if you tried the following:

PowerShell says "execution of scripts is disabled on this system."

http://sqlish.com/file-ps1-cannot-be-loaded-because-the-execution-of-scripts-is-disabled-on-this-system-please-see-get-help-about_signing-for-more-details/

Powershell profile.ps1 cannot be loaded because its operation is blocked by software restriction policies

if all fails do the below:

It's possible that you changed the execution policy for 64-bit powershell and the package manager is running 32-bit (or vice versa).

I'd try opening 32-bit console (PowerShell (x86)) and setting the execution policy there, as the error is definitely pointing to that kind of resolution.

Make sure you restart visual studio after changing execution policy so that changes can take effect. Also make sure you changed execution policy globally with administrator username and password.

Source:file cannot be loaded because the execution of scripts is disabled on this system

Community
  • 1
  • 1
DeJaVo
  • 3,091
  • 2
  • 17
  • 32
0

As a workaround, I found this solution (more details at stackoverflow.com/a/53433786/8358565)

Execute the following commands in the Package Manager Console

Set-ExecutionPolicy -Scope Process Bypass
Import-Module "your-solution-directory/packages/EntityFramework<your EF version>/EntityFramework.psd1"
antoninod
  • 338
  • 3
  • 10