3
File C:\Users\Acer\Desktop\Projelerim\BEM_CANLI\BEM\packages\EntityFramework.5.
0.0\tools\init.ps1 cannot be loaded because its execution is blocked by softwar
e restriction policies. For more information, contact your system administrator.
At line:1 char:44
+ $__pc_args=@(); $input|%{$__pc_args+=$_}; & <<<<  'C:\Users\Acer\Desktop\Proj
elerim\BEM_CANLI\BEM\packages\EntityFramework.5.0.0\tools\init.ps1' $__pc_args[
0] $__pc_args[1] $__pc_args[2]; Remove-Variable __pc_args -Scope 0
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

I get above error in package manager console. I found some solution, but I cant fix it. I tried followings

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/

I changed execution policy,

enter image description here

But I allways get the same error.

Community
  • 1
  • 1
AliRıza Adıyahşi
  • 14,706
  • 23
  • 108
  • 189
  • The solution of setting the policy to RemoteSigned in Powershell worked for me. I had to start Powershell as an administrator and then restart Visual Studio afterwards. – Patrick J Collins Apr 24 '14 at 09:19

3 Answers3

6

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.

Mike Shepard
  • 15,897
  • 6
  • 46
  • 61
  • there are three powershell, Powershell(x86), powershell and poweshell modules. I did it for these three... I try to find any solution, thanks... – AliRıza Adıyahşi Oct 01 '13 at 05:26
1

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.

0

We have been facing the same issue today with Visual Studio 2017 and Entity Framework 6, and none of the solutions proposed here has worked. As a workaround, this is the temporary solution we found to be able to use Entity Framework commands in the Package Manager Console:

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"

Actually, the Import-Module command is what the init1.ps1 script does.

antoninod
  • 199
  • 1
  • 6