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.

You got error like this or simular:

Package Installation Error
Could not add all required packages to the project. The following packages failed to install from 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\K4NWZ1KQ.YDX\Packages':
EntityFramework.6.0.0 : 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.
Newtonsoft.Json.5.0.8 : 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.
EPiServer.Framework.7.15.0 : 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.
EPiServer.CMS.Core.7.15.0 : 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.
EPiServer.CMS.UI.Core.7.15.0 : 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.
EPiServer.Packaging.3.1.5 : 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.
EPiServer.CMS.7.15.0 : 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.
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.

So you got this error, you searched google, and found only clues as to how to solve it. Maybe you went to stackoverflow and found suggestions, did you find the suggestions about needing to set powershell executionpolicy to remotesigned, or maybe regedit? Well, i know i did. Dint help... Heres the answer:





Problem comes with an update from MS to VS. It changes the config file. And you need to append to the config file.

I edited the config file as described below, you can only delete the entire %APPDATA%..\Local\Microsoft\VisualStudio\ folder, as VS will recreate it. However, adding the following should be enough.
Heres how you do it:
  1. Close Visual Studio
  2. Open %APPDATA%\..\Local\Microsoft\VisualStudio\12.0\devenv.exe.config in a text editor
  3. Append the following to <runtime> <assemblyBinding>:
  4. <dependentAssembly> <assemblyIdentity name="System.Management.Automation" publicKeyToken="31bf3856ad364e35" /> <publisherPolicy apply="no" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.PowerShell.Commands.Utility" publicKeyToken="31bf3856ad364e35" /> <publisherPolicy apply="no" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.PowerShell.ConsoleHost" publicKeyToken="31bf3856ad364e35" /> <publisherPolicy apply="no" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.PowerShell.Commands.Management" publicKeyToken="31bf3856ad364e35" /> <publisherPolicy apply="no" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.PowerShell.Security" publicKeyToken="31bf3856ad364e35" /> <publisherPolicy apply="no" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.PowerShell.Commands.Diagnostics" publicKeyToken="31bf3856ad364e35" /> <publisherPolicy apply="no" /> </dependentAssembly>
  5. Save devenv.exe.config and start Visual Studio and try "New project" again.

Popular posts from this blog

[SOLVED] Veeam: Failed change tracking (CBT)

Fixing Error 25541. Failed to open XML file