20

Package manager console crash in visual studio 2015 enterprise just after start with error:

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 RemoteSigned. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information please see "Get-Help Set-ExecutionPolicy".

I have tryied a lot of things like like setting execution policy in power shell to remoteSigned but nothing helped, nuget still don't work.

Any one have the same issue? Thanks for any advance.

Maris
  • 4,608
  • 6
  • 39
  • 68
  • Please be more specific: how does *crash* manifest itself exactly? You just show an error message of the console.. – stijn Jul 22 '15 at 09:38
  • 2
    Have the same problem; package manager console is not working, just that error. I tried setting policy to unrestricted, working fine in 2013 but not in 2015! – Hrvoje Hudo Jul 22 '15 at 09:40
  • @stijn . I just start visual studio 2015 and see in package manager console that message. Looks like Microsoft didn't signed some powershell scripts... – Maris Jul 22 '15 at 09:45
  • @HrvojeHudo yeap, I've tried it also, and also without success... – Maris Jul 22 '15 at 09:46
  • I have the same problem, my question is [here](http://stackoverflow.com/questions/31558957/visual-studio-nuget-error-with-global-unrestricted-executionpolicy) (even a few minutes older:). – Wilbert Jul 22 '15 at 09:51
  • 1
    Tried every possible combination of set-executionpolicy on 32 and 64 bit ps process. Strange thing is that "Windows PowerShell updated your execution policy successfully" but it just stops there, can't type anything to the console. – Hrvoje Hudo Jul 22 '15 at 09:51
  • 2
    It's even worse because the same issue also disallows just installing packages (because install.ps1 cannot be executed). – Wilbert Jul 22 '15 at 09:52
  • I've made ticket here: https://connect.microsoft.com/VisualStudio/feedback/details/1572078 who have the same problem please upvote it. – Maris Jul 22 '15 at 09:52
  • 1
    I have asked at msdn forum also: https://social.msdn.microsoft.com/Forums/vstudio/en-US/a5ad26cf-3a94-46d1-a787-2d934ac66df2/visual-studio-2015-package-manager-console-execution-policy-problem?forum=visualstudiogeneral – Hrvoje Hudo Jul 22 '15 at 10:08
  • have the same problem in VS2013 after yesterday's NuGet update =( – Pavel Voronin Jul 22 '15 at 20:20
  • @voroninp Workaround mentioned below works as well for VS2013, so you can use it until MS will fix that bug. – Maris Jul 23 '15 at 06:06
  • @Maris I installed earlier version from codeplex =) – Pavel Voronin Jul 23 '15 at 13:03

4 Answers4

34

Microsoft has published a hotfix for that issue, here is information how to apply it:

A hotfix is now available to install. Please grab the install from one of these locations appropriately:

2.8.7 for VS 2013: https://github.com/NuGet/Home/releases/download/2.8.7/NuGet.Tools.vsix

3.1.1 for VS 2015: https://github.com/NuGet/Home/releases/download/3.1.1/NuGet.Tools.vsix

NuGet will publish these to the Visual Studio gallery next week.

For more information visit this page: https://connect.microsoft.com/VisualStudio/feedback/details/1572078/nuget-crash-in-visual-studio-2015-enterprise

Maris
  • 4,608
  • 6
  • 39
  • 68
14

I had the same issue and found solution that worked for me: set execution policy to "Undefined" in all scopes (Remove registry key for Machine and User scopes if they are set by domain policy) and then restart VS and open Package Manager Console.

Edit: path to key I deleted:

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell

Key: ExecutionPolicy

This command line can be used to automate the process (run as admin), until issue is fixed:

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell /v ExecutionPolicy /f
Hrvoje Hudo
  • 8,994
  • 5
  • 33
  • 42
Encarmine
  • 453
  • 3
  • 13
  • Yes, it works, thank you! But however execution policy is being restored by the domain policy so It helps only until next restart! – Maris Jul 22 '15 at 10:21
  • I agree that in case of Domain Policy this is just a temporary workaround. For permanent fix you can either change domain policy or wait for MS to fix that horrible behavior. – Encarmine Jul 22 '15 at 10:26
9

After a completely clean install of Visual Studio Professional 2015 from the MSDN Website, I ran VS2015 as Administrator, opened up the Package Manager Console from Tools -> NuGet Package Manager... -> Package Manager Console and I received this error:

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

By following the above steps to:

  1. Use Tools -> Extensions and Updates... to uninstall NuGet Package Manager for Visual Studio 2015.

  2. Restart Visual Studio.

  3. Use Tools -> Extensions and Updates... to re-install NuGet Package Manager for Visual Studio 2015.

  4. Restart Visual Studio.

Now when I open up the Package Manager Console, Powershell loads correctly and every thing is good. Hopefully this helps without having to override or set the execution policy.

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
bradykey
  • 443
  • 2
  • 7
  • This worked for me - though i'm not sure id it only worked because when initially installed i did not have admin access, and then i got it for VS, then followed these steps. – will May 05 '16 at 09:18
0

I get the following error in VS 2013 under Tools\Nuget package Manager\ Package Manager console....

Issue: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

I uninstalled the Nuget Package manager using Tools\Extension and Updates uninstalled the Nuget Package Manager.

Reinstalled the package manager from below location to solve the issue.

https://marketplace.visualstudio.com/items?itemName=NuGetTeam.NuGetPackageManagerforVisualStudio2013

gyansada
  • 41
  • 2