我有一个新的空MVC 5项目,我尝试安装Nuget软件包。
当我在Nuget控制台中插入命令:Update-Package时,我得到以下消息:
File E:\WebApp\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\uninstall.ps1 cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.At line:1 char:3
+ & 'E:\WebApp\packages\Microsoft.CodeDom.Providers.Dot ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
然后我开始安装一些新软件包,并再次收到此消息:
无法加载WebApp \ packages \ Modernizr.2.8.3 \ tools \ install.ps1,因为在此系统上禁用了运行脚本
我看到了一些与此消息相关的帖子,但与MVC项目无关。
我的问题是:
为什么我收到这些消息?
我该怎么做才能解决此问题?
此问题可以出现在运行我的应用程序的服务器上吗?一些脚本无法按预期运行?
最佳答案
我想您要安装的特定软件包需要运行Powershell脚本,并且由于某种原因,您的计算机上禁用了Powershell执行。
您可以在“如何启用Powershell”上搜索google以获得完整指南,但通常情况如下:
Get-ExecutionPolicy
Set-ExecutionPolicy remotesigned
此问题不会影响您计划在其上安装应用程序的服务器。
关于asp.net-mvc - Nuget给出错误 “ps1 cannot be loaded because running scripts is disabled”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32692087/