I updated to Visual Studio 2013.5 and installed Visual Studio 2015 yesterday. Since the installation of the updates, NuGet doesn't work anymore in both Visual Studio versions.
The error I get is:
Set-ExecutionPolicy : 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".
There are solutions to similar problems here, here and here, however, they don't help me. The difference seems to be the following:
Those answers solve the case when the user does not have enough permissions. However, in my case, we have a global group policy that forces an 'Unrestricted' execution policy (...yeah, I know).
So when Visual Studio tries to set process permissions for its NuGet console or NuGet backend to RemoteSigned, it fails because the global, more permissive setting overrides this. This seems to cause an error that makes NuGet fail completely:
- If I open the Package Manager Console in VS, the red error message appears, but no prompt.
- If I try to install a package using the GUI, package installation fails because it cannot run the ..../install.ps1 script.
I tried starting VS as an administrator, manually setting all ExecutionPolicies I can modify as local (non-domain) admin to either Unrestricted or RemoteSigned, and repairing the VS install.
Using Get-ExecutionPolicy -List
, I get the following Output:
MachinePolicy Unrestricted
UserPolicy Undefined
and Process, CurrentUser and LocalMachine are either undefined, or contain whatever value I set them to.
Note that the global unrestricted policy was in place before the VS upgrades, so either the install itself broke something, or the new versions have a different behavior.
How can I get Powershell/NuGet to work again?