由于“无法初始化PowerShell主机”,无法安装nuget软件包

时间:2021-06-18 20:27:26

Can't install nuget package because of “Failed to initialize the PowerShell host” This is the Error The following error occurred while loading the extended type data file: , C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\2ZQ00DAJ.XOI\Modules\NuGet\NuGet.Types.ps1xml: The file was skipped because of the following validation exception: File C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\2ZQ00DAJ.XOI\Modules\NuGet\NuGet.Types.ps1xml cannot be loaded because its operation is blocked by software restriction policies, such as those created by using Group Policy..

由于“无法初始化PowerShell主机”无法安装nuget软件包这是错误加载扩展类型数据文件时出现以下错误:,C:\ PROGRAM FILES(X86)\ MICROSOFT VISUAL STUDIO 14.0 \ COMMON7 \ IDE \ EXTENSIONS \ 2ZQ00DAJ.XOI \ Modules \ NuGet \ NuGet.Types.ps1xml:由于以下验证异常,文件被跳过:文件C:\ PROGRAM FILES(X86)\ MICROSOFT VISUAL STUDIO 14.0 \ COMMON7 \ IDE \ EXTENSIONS \ 2ZQ00DAJ无法加载.XOI \ Modules \ NuGet \ NuGet.Types.ps1xml,因为其操作被软件限制策略阻止,例如使用组策略创建的策略。

1 个解决方案

#1


-1  

Since you're using VS 2015 x86, you should start a 32bit version of PowerShell/PowerShell ISE as Administrator (won't work if you just' start it without elevated rights, will give you an error) and change ExecutionPolicy to RemoteSigned, like this

由于您使用的是VS 2015 x86,因此您应该以管理员身份启动一个32位版本的PowerShell / PowerShell ISE(如果您只是在没有提升权限的情况下启动它,将会发生错误)并将ExecutionPolicy更改为RemoteSigned,就像这个

Set-ExecutionPolicy RemoteSigned

and after, restart your Visual Studio. Personally, I don't have it here to test, but think this will fix the error you're getting.

之后,重新启动Visual Studio。就个人而言,我没有在这里测试,但认为这将解决你得到的错误。

#1


-1  

Since you're using VS 2015 x86, you should start a 32bit version of PowerShell/PowerShell ISE as Administrator (won't work if you just' start it without elevated rights, will give you an error) and change ExecutionPolicy to RemoteSigned, like this

由于您使用的是VS 2015 x86,因此您应该以管理员身份启动一个32位版本的PowerShell / PowerShell ISE(如果您只是在没有提升权限的情况下启动它,将会发生错误)并将ExecutionPolicy更改为RemoteSigned,就像这个

Set-ExecutionPolicy RemoteSigned

and after, restart your Visual Studio. Personally, I don't have it here to test, but think this will fix the error you're getting.

之后,重新启动Visual Studio。就个人而言,我没有在这里测试,但认为这将解决你得到的错误。