NuGet – Failed to Initialize the PowerShell Host

Recently I loaded a NuGet package into my Visual Studio project, only to be greeted with the 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

A little searching yielded a post detailing PowerShell security over on Hanselman's blog. This post got me headed in the right direction to solve the issue.

The NuGet package I tried to install was running an unsigned PowerShell script used to add a few code files into the project. Note that before you do the following you need to trust the author of the script. Understand the implications involved in lowering the PowerShell security model. If you are comfortable that the script being ran is not malicious, proceed.

Note: Do not leave the execution policy unrestricted! Also, you will need to leave PowerShell running while you do this, or you'll get the same error.