While using NuGet for installing, updating and maintaing libraries into your projects, you would have encountered following error:
Failed to initialize the PowerShell host. If your PowerShell execution policy setting is set to AllSigned, open the Package Manager Console to initialize the host first.
Following error was encounted when I tried to update Entity Framework NuGet package in one of my project
To resolve this issue quickest way is to open the Package Manager Console window in visual studio, which will initialize the powershell execution context for NuGet packages to use.
You can open up the package manager console from top menu in visual studio - View > Other Windows > Package Manager Console
If the problem still persists then you can close all instance of Visual Studio currently running and then open up Windows Powershell in administrator mode and fire following command:
Set-ExecutionPolicy AllSigned
Type Yes
to confirm - change in execution policy.
Open up the visual studio project again and keep the Package Manager Console open, then try to install / update the NuGet package again.
This time it would install / update the package successfully.
Happy Coding !!