Failed to initialize the PowerShell host
Posted on: 2014-04-24
During the migration of Entity Framework to 6.1.0 I received an error about PowerShell host that failed to initialized.
Adding 'EntityFramework 6.1.0' to BusinessLogicUnitTest. Successfully added 'EntityFramework 6.1.0' to BusinessLogicUnitTest. Executing script file 'C:\Users\Patrick\Documents\TFS\BourseVirtuelle\Code\BourseVirtuelle\packages\EntityFramework.6.1.0\tools\install.ps1'. 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.
The problem was the system has it executions policy to restrictive. One way to fix the problem is to open a PowerShell console as administrator and to set the execution policy to unrestricted.
Set-ExecutionPolicy Unrestricted
From there, open again Visual Studio 2013 and open the Package Manager Console. This was also required before using Nuget to update Entity Framework. Opening the Package Manager Console seem to execute a Power Shell script named Profile.ps1 located in your Program Files folder.
C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\Extensions\\b331wcwx.fbh\\Modules\\NuGet\\Profile.ps1