0

I understand there is a relationship between PowerShell and .NET, but I can't locate the details via Google. I was able to setup a fresh Linux instance that didn't have PowerShell or .NET, and then only installed PowerShell. PS cmdlets worked normally. When I looked at the .NET runtimes, none were listed.

Questions:

  • What is the relationship/mapping between PowerShell and .NET?
  • Is there a document that shows the mapping?
  • Is you have more than one .NET runtime installed which one is used by PowerShell?

====================================

UPDATE

I created a follow-up question based on the answer below: PowerShell 7.0 / 7.1 and .NET runtimes

1
  • Looks like the follow-up post asks the same question, and has a helpful answer. Can this be closed as redundant?
    – SamErde
    Oct 10 '20 at 13:41
0

Windows PowerShell System Requirements

https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/install/windows-powershell-system-requirements?view=powershell-7

Common Language Runtime 4.0

Windows PowerShell 3.0, Windows PowerShell 4.0, and Windows PowerShell 5.0 are compiled against Common Language Runtime (CLR) 4.0.

Windows PowerShell engine requirements

The Windows PowerShell 2.0 engine's minimum requirement is Microsoft .NET Framework 2.0.50727. This requirement is fulfilled by Microsoft .NET Framework 3.5 Service Pack 1.

Nearly everything will use CLR 4.0, unless a module manifest specifies CLR 2 or you start PowerShell with the -Version 2.0 switch.

https://stackoverflow.com/questions/63520845/determine-net-and-clr-requirements-for-your-powershell-modules

https://docs.microsoft.com/en-us/powershell/scripting/developer/module/how-to-write-a-powershell-module-manifest

powershell -version 2.0
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS > $PSVersionTable

Name                           Value
----                           -----
CLRVersion                     2.0.50727.9151
BuildVersion                   6.1.7600.16385
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1
2
  • Thank you, great information. It doesn't look like they have this for 7.0, but I did see an article that says that uses 3.1. And 7.1 (in development) would use .NET 5. Oct 2 '20 at 20:08
  • @HeadInCloud: from what I've seen, PowerShell Core 7 doesn't even report the CLR version. PowerShell Core and .NET Core are fundamentally different products though from the perspective of runtime dependencies.
    – Greg Askew
    Oct 3 '20 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.