Which .NET version is my PowerShell script using?

后端 未结 7 1217
情话喂你
情话喂你 2020-12-09 01:23

I\'d like to use .NET in some PowerShell scripts I\'m about to write -- how do I know/declare which version of .NET I\'m dealing with when these scripts run?

And is

相关标签:
7条回答
  • 2020-12-09 01:52

    To get the .NET version:

    [System.Reflection.Assembly]::GetExecutingAssembly().ImageRuntimeVersion
    

    ...which is, by default, the version of the CLR the assembly (System.Management.Automation.dll) compiled under.

    And no, you cannot choose which .NET version you can run the script under.

    0 讨论(0)
提交回复
热议问题