2.0 version of System.Management.Automation?

自作多情 提交于 2019-12-10 03:54:27

问题


Is there a 2.0 (or greater) version of the System.Management.Automation assembly?

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?

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.

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

And Reference Assemblies:

C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0

Both containing folders only have version 1.0

I have PowerShell 2.0 installed.


回答1:


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.

Just to confuse matters further, the windows folder name for all versions is v1.0 - again, for reasons of compatibility.

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.

I hope this helps.



来源:https://stackoverflow.com/questions/17053786/2-0-version-of-system-management-automation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!