AGlasencnik
AGlasencnik

Reputation: 159

Visual Studio 2019: Failed to initialize the powershell host

I know my question is very similar to this one (Visual Studio Package Installation Error: "Failed to initialize the PowerShell host."). But still the answer that was given there didn't solve my issue.

So like the guy in the link above I have a problem in Visual Studio when I try to create a Web Forms Application or when I want to download and install some Nuget packages (example: AWS DynamoDB sdk) it gives me this 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.

When I did some browsing I came across this command:

Set-ExecutionPolicy Unrestricted

But that didn't help. I still got the error. In the link above someone shares this command:

start-job { Set-ExecutionPolicy Unrestricted } -RunAs32 | wait-job | Receive-Job

But I don't really know what difference it makes or what it actually does. After trying the first command and doing:

Get-ExecutionPolicy

I got a response that the value is Unrestricted. But in the other command it was still AllSigned. I also tried running Visual Studio as administrator and that didn't help either.

Upvotes: 1

Views: 1604

Answers (1)

AGlasencnik
AGlasencnik

Reputation: 159

I figured out, that there was a certificate from Microsoft on the Untrusted list, and I needed to delete it, and now it works.

Upvotes: 1

Related Questions