• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Getting PowerShell to use .NET 4.0 runtime

C

Chuck Heatherly

#1
(Reposted from a Stack Overflow discussion, I just verified that the tip works.)

Once you have installed .NET 4.0 and/or Visual Studio 2010, you may notice that PowerShell and other .NET applications
still use the 2.0 runtime. To make them use the 4.0 runtime, add these values to the registry:

32-bit apps on a 32-bit operating system
64-bit apps on a 64-bit operating system
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]
"OnlyUseLatestCLR"=dword:00000001

32-bit apps on a 64-bit operating system
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework]
"OnlyUseLatestCLR"=dword:00000001

You do not need to reboot after adding/changing these values. Note that this change affects ALL .NET applications on the
machine. Before the change, opening a PowerShell prompt and executing: [Environment]::Version.ToString() returns
"2.0.50727.4927". After the change, it returns "4.0.30319.1".

Original discussion:
http://stackoverflow.com/questions/2094694/launch-powershell-under-net-4
 

My Computer

M

Marco Shaw [MVP]

#2
Thanks for the tip...

Marco

"Chuck Heatherly" <chuck.heatherly@newsgroup> wrote in message
news:44nts55o82mvu5lp5cinq2pt1g60n171bf@newsgroup

>
> (Reposted from a Stack Overflow discussion, I just verified that the tip
> works.)
>
> Once you have installed .NET 4.0 and/or Visual Studio 2010, you may notice
> that PowerShell and other .NET applications
> still use the 2.0 runtime. To make them use the 4.0 runtime, add these
> values to the registry:
>
> 32-bit apps on a 32-bit operating system
> 64-bit apps on a 64-bit operating system
> [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]
> "OnlyUseLatestCLR"=dword:00000001
>
> 32-bit apps on a 64-bit operating system
> [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework]
> "OnlyUseLatestCLR"=dword:00000001
>
> You do not need to reboot after adding/changing these values. Note that
> this change affects ALL .NET applications on the
> machine. Before the change, opening a PowerShell prompt and executing:
> [Environment]::Version.ToString() returns
> "2.0.50727.4927". After the change, it returns "4.0.30319.1".
>
> Original discussion:
> http://stackoverflow.com/questions/2094694/launch-powershell-under-net-4
 

My Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)