Saturday, June 7, 2014

NuGet - Failed to initialize the PowerShell Host.

While loading AutoMapper from NuGet, I encountered 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 the following post.

The trick is to close Visual Studio, open PowerShell as an administrator, then change the execution policy to something less restrictive.  Then re-open Visual Studio, and re-attempt the NuGet install. I've noticed if I don't leave PowerShell running when I do this, it doesn't work.  Notice that the magic PowerShell command is "Set-ExecutionPolicy" Unrestricted

I had to iterate on this a few times, and to get AutoMapper to install I had to go all the way down to Unrestricted.  After updating I changed it back to AllSigned...

No comments:

Post a Comment