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

孤人 提交于 2019-12-20 02:04:12

问题


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,

But I allways get the same error.


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/19100481/file-cannot-be-loaded-because-the-execution-of-scripts-is-disabled-on-this-syste

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!