Powershell x64无法在Windows 8.1中启动

时间:2021-11-22 00:39:14

The problem I need to be solved is that the Nuget Package Manager Console in Visual Studio 2013 cannot start because the Windows Powershell raises the error:

我需要解决的问题是Visual Studio 2013中的Nuget包管理器控制台无法启动,因为Windows Powershell引发了错误:

The shell cannot be started. A failure occurred during initialization: The type initializer for 'System.Management.Automation.SessionStateScope' threw an exception.

shell无法启动。初始化期间发生故障:“System.Management.Automation.SessionStateScope”的类型初始值设定项引发异常。

I tried reinstalling nuget, repairing VS2013, changing the execution policy in powershell x86 (the common solution given here in *) but the error persists.

我尝试重新安装nuget,修复VS2013,更改powershell x86中的执行策略(此处在*中给出的常见解决方案),但错误仍然存​​在。

Until I realize that the problem is in the x64 powershell(C:\Windows\SysWOW64\WindowsPowerShell\v1.0) because the x86 version is fine.

直到我意识到问题出在x64 powershell(C:\ Windows \ SysWOW64 \ WindowsPowerShell \ v1.0)中,因为x86版本没问题。

I'm using Visual Studio Ultimate 2013 Update 4 32-Bits in Windows 8.1 x64

我在Windows 8.1 x64中使用Visual Studio Ultimate 2013 Update 4 32位

3 个解决方案

#1


1  

I found out the answer, it has to do with the legacy security policy in .Net

我找到了答案,它与.Net中的遗留安全策略有关

I open the file C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config and set the attribute "enabled" to False in the tag NetFx40_LegacySecurityPolicy and voilá, the powershell of SysWoW64 is working.

我打开文件C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Config \ machine.config并在标签NetFx40_LegacySecurityPolicy和voilá中将属性“enabled”设置为False,SysWoW64的powershell工作正常。

#2


0  

In my case I was receiving this same error for an unknown reason and thanks to this hint I looked for the NetFx40_LegacySecurityPolicy in

在我的情况下,我收到同样的错误,原因不明,并且由于这个提示我在寻找NetFx40_LegacySecurityPolicy in

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ CONFIG \ machine.config中

and

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config

C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 \ CONFIG \ machine.config中

but could not find that tag...

但找不到那个标签......

I did see LegacyCasPolicy enabled="true" in

我确实看到LegacyCasPolicy enabled =“true”in

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config

C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 \ CONFIG \ machine.config中

and set it to false...viola, worked like a charm...Had no idea of how this got set but could not find a solution to this problem anywhere, and no, I did not have any corrupted system files.

并将其设置为假...中提琴,工作就像一个魅力...不知道这是如何设置但无法找到解决这个问题的任何地方,不,我没有任何损坏的系统文件。

#3


0  

Same issue different key.

同样问题不同的关键。

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config

C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 \ CONFIG \ machine.config中

Change to false

改为false

NetFx40_LegacySecurityPolicy enabled="true"

#1


1  

I found out the answer, it has to do with the legacy security policy in .Net

我找到了答案,它与.Net中的遗留安全策略有关

I open the file C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config and set the attribute "enabled" to False in the tag NetFx40_LegacySecurityPolicy and voilá, the powershell of SysWoW64 is working.

我打开文件C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Config \ machine.config并在标签NetFx40_LegacySecurityPolicy和voilá中将属性“enabled”设置为False,SysWoW64的powershell工作正常。

#2


0  

In my case I was receiving this same error for an unknown reason and thanks to this hint I looked for the NetFx40_LegacySecurityPolicy in

在我的情况下,我收到同样的错误,原因不明,并且由于这个提示我在寻找NetFx40_LegacySecurityPolicy in

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ CONFIG \ machine.config中

and

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config

C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 \ CONFIG \ machine.config中

but could not find that tag...

但找不到那个标签......

I did see LegacyCasPolicy enabled="true" in

我确实看到LegacyCasPolicy enabled =“true”in

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config

C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 \ CONFIG \ machine.config中

and set it to false...viola, worked like a charm...Had no idea of how this got set but could not find a solution to this problem anywhere, and no, I did not have any corrupted system files.

并将其设置为假...中提琴,工作就像一个魅力...不知道这是如何设置但无法找到解决这个问题的任何地方,不,我没有任何损坏的系统文件。

#3


0  

Same issue different key.

同样问题不同的关键。

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config

C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 \ CONFIG \ machine.config中

Change to false

改为false

NetFx40_LegacySecurityPolicy enabled="true"