Trying to install a new Alloy MVC Site in one of my machine's Visual Studio 2013 threw error alerts.

  • 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.

When opening the Package Manager Console I found this error message:

  • The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2977) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.

I found a lot of suggestions about changing ExecutionPolicy but it was this Stack Overflow thread that contained a fix that worked: Embedding Powershell v2.0 in .NET app on Windows 8 RTM

I edited the config file as described below but note that the thread also contains the more harsh suggestion to delete the entire %APPDATA%..\Local\Microsoft\VisualStudio\ folder. It's supposedly recreated with a working file on next startup. Anyway these are the steps I took:

  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>.
    <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>
    
  4. Save devenv.exe.config and start Visual Studio and try "New project" again.

Added Thursday 29 January 2015 09:00 — Tags for this page: Episerver, Troubleshooting

Comments

Add Your Comment