gpt4 book ai didi

visual-studio-2013 - NuGet 包管理器控制台 (PMC) 策略设置

转载 作者:行者123 更新时间:2023-12-03 14:44:27 28 4
gpt4 key购买 nike

在 VS2013 中,当我尝试打开 NuGet 包管理器控制台时,突然出现错误:

Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope.
Due to the override, your shell will retain its current effective execution policy of Unrestricted. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information please see "Get-Help Set- ExecutionPolicy".



如果我在 PowerShell 提示符下运行“Get-ExecutionPolicy -List”,我会得到以下信息:
Scope                 ExecutionPolicy
----- ---------------
MachinePolicy Unrestricted
UserPolicy Unrestricted
Process Unrestricted
CurrentUser RemoteSigned
LocalMachine Undefined

不确定这是否正确,但在我的同事 PC 上,策略设置为:
Scope                 ExecutionPolicy
----- ---------------
MachinePolicy Unrestricted
UserPolicy Undefined
Process Unrestricted
CurrentUser RemoteSigned
LocalMachine Undefined

猜测问题是“UserPolicy”,所以我尝试执行以下命令:
Set-ExecutionPolicy Undefined -Scope UserPolicy

这给了我错误信息:

Set-ExecutionPolicy : Cannot set execution policy. Execution policies at the MachinePolicy or UserPolicy scopes must be set through Group Policy.



不太确定现在该怎么办。任何解决此问题的帮助将不胜感激。

最佳答案

这似乎发生在加入域的工作站上,并且域的组策略包括特定的 PowerShell ExecutionPolicy 设置。
现在,请参阅此处提供的选项:https://powershellpanda.wordpress.com/2013/12/01/override-gpo-for-powershell-execution-policy/
就个人而言,我正在使用临时修复程序。暂时清除从我的域下推的执行策略。 (它当然会回来,但至少我现在可以继续工作,直到找到更永久的解决方案。)
这是我使用的 regedit 脚本:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell]
"ExecutionPolicy"=-
另见: https://github.com/NuGet/Home/issues/974#issuecomment-123410075
更新
我认为这只是昨天发布的 Visual Studio 2013 更新 5 的一个问题。
顺便说一下,它也会影响 Visual Studio 2015 (RTM)。
更新 2
现在可以使用适当的 nuget 修复(适用于 VS2013 和 VS2015),根据这篇文章: https://github.com/NuGet/Home/issues/974#issuecomment-124774650

关于visual-studio-2013 - NuGet 包管理器控制台 (PMC) 策略设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31536446/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com