none
I am getting an error when trying to create an empty WEB project (using WEB API RRS feed

  • Question

  • I am using VS 2013 (with update 5).

    Create a new project - Visual C# ASP.Net Web application.

    Give it a name etc. OK

    Select the empty template. 

    Add folder and core reference for: Web API

    I get an error dialog

    "Could not add all the required packages to the project. The following packages failed to install from

    "c:\program files\Microsoft ASP.Net\Asp.Net Web Stack 5\Packages':

    NewtonSoft.Json.6.0.4 : Failed to initialize the powershell host. If your powershell execution policy is set to allsigned, open the package manager console to initialize the host first.

    I am running VS as admininistrator.

    If I open NUget PAckage manager consol (from the tools menu) - I get a lot of red text

    "Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope.  Due to the override, your shell will retain its current effective execution policy of "RemoteSigned". Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information, please see "Get-Help Set-ExecutionPolicy."

    I have tried changing the PS execution  policy on the machine (as an admin) - but cannot due to group policy settings.

    Is there anything I can do to get round this ?

    Thursday, November 5, 2015 11:30 AM

Answers

  • Found a way to resolve without changing group policy.

    I edited the registry as an Admin to set the execution  policy key to Bypass:

    HKEY_LOCAL_MACHINE\software\policies\Microsoft\Windows\Powershell

    Set the executionPolicy to Bypass (normally RemoteSigned)

    This worked for me.


    • Marked as answer by goofygdog2 Thursday, November 5, 2015 4:01 PM
    • Edited by goofygdog2 Thursday, November 5, 2015 4:01 PM
    Thursday, November 5, 2015 4:01 PM

All replies

  • If its a machine under GrouPolicies and the GroupPolicy is to not let PSscripts execute, no there ain't.

    But if you're on your LocalMachine and there is noone else but you (so no admin) then you can of course change the GroupPolicy in question via the mmc.exe

    (WinKey + r) (type: mmc) (Enter) (click: File) (click: Add/Remove SnapIn) (select: Local Group Policies)

    Look for the */Administrative Templates/Windows Components/Windows PowerShell/Turn on Script Execution. You should enable this.

    If that doesn't do it, there is a deny scripts for applications or deny shell executioon for applications or something similar set on your system somewhere. In that case you'll have to browse through the policies and see if you can find it.

    (This answere is not in any way given out of expereince with a similar error but from the given Error messages alone, it might not be GPO related at all)


    • Edited by MDeero Thursday, November 5, 2015 1:39 PM
    Thursday, November 5, 2015 1:39 PM
  • Found a way to resolve without changing group policy.

    I edited the registry as an Admin to set the execution  policy key to Bypass:

    HKEY_LOCAL_MACHINE\software\policies\Microsoft\Windows\Powershell

    Set the executionPolicy to Bypass (normally RemoteSigned)

    This worked for me.


    • Marked as answer by goofygdog2 Thursday, November 5, 2015 4:01 PM
    • Edited by goofygdog2 Thursday, November 5, 2015 4:01 PM
    Thursday, November 5, 2015 4:01 PM
  • http://forums.asp.net/1246.aspx/1?Web+API

    There is a forum for Web API.

    Thursday, November 5, 2015 8:28 PM
  • it's was really good-

    Thank a lot

    Tuesday, June 6, 2017 1:13 PM