问题描述
System.Management.Automation
程序集是否有2.0(或更高版本)版本?
Is there a 2.0 (or greater) version of the System.Management.Automation
assembly?
我正在查看 PowerShell
类在C#中表示该类是在PowerShell 2.0
中引入的.该版本号是否与在Visual Studio中将引用添加到程序集时看到的版本号相对应?
I'm looking at the PowerShell
class in C# which says that this class was introduced with PowerShell 2.0
. Does that version number correspond with the version number I'm seeing when I add the reference to the assembly in Visual Studio?
对于我的其他问题,这是一个额外的问题关于解决该程序集中的PowerShell
类有麻烦.
This is kind of an additional question to my other question which is in regards to having trouble resolving the PowerShell
class inside that assembly.
我已经在两个GAC中尝试了System.Management.Automation
程序集:
I've tried the System.Management.Automation
assembly in both the GAC:
C:\Windows\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35
和Reference Assemblies
:
C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0
两个文件夹都只有1.0版
Both containing folders only have version 1.0
我已安装PowerShell 2.0.
I have PowerShell 2.0 installed.
推荐答案
powershell v1和powershell v2的强名称版本为1.0.0.0
.令人惊讶的是,但这是向后兼容设计的功能. powershell v1和v2均在CLR2上运行. Powershell v3在CLR4上运行,因此他们将强名称版本更改为3.0.0.0
.
The strong name version for both powershell v1 and powershell v2 is 1.0.0.0
. Surprising, yes, but this is a function of the backwards compatibility design. Both powershell v1 and v2 run on CLR2. Powershell v3 runs on CLR4, so they bumped the strong name version to 3.0.0.0
for that one.
为了进一步混淆,所有版本的Windows文件夹名称均为v1.0-出于兼容性考虑.
Just to confuse matters further, the windows folder name for all versions is v1.0 - again, for reasons of compatibility.
您实际运行真正的Powershell v1.0的唯一方法是在Windows XP,Vista或Server 2003/2008上.如果您运行的是Windows 7、2008r2,则至少要使用v2.如果您使用的是8或2012,则至少要使用Powershell v3.
The only way you could actually be running the real powershell v1.0 is if you're on windows XP, vista or server 2003/2008. If you are running windows 7, 2008r2, you are on v2 at a minimum. If you are on 8 or 2012, you are on v3 of powershell at a minimum.
我希望这会有所帮助.
这篇关于System.Management.Automation的2.0版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!