1

I've read the whole thread about running PowerShell under .NET 4.0, including the warnings about what happens when using the registry keys to make the scripts run under that framework.

So far, I only get the desired result with the registry keys. Is anyone aware of a way to make this work without changing the registry keys? When I checked PowerGUI's discussion boards, even they pointed to the stackoverflow thread. Has anyone come up with something better since April 2010?

Community
  • 1
  • 1
Scott Lawrence
  • 6,993
  • 12
  • 46
  • 64

3 Answers3

4

1- Go to: "C:\Program Files (x86)\PowerGUI" and create a "ScriptEditor.exe.config" file.

2- Paste this xml in the file

<?xml version="1.0"?> 
<configuration> 
    <startup useLegacyV2RuntimeActivationPolicy="true"> 
        <supportedRuntime version="v4.0.30319"/> 
        <supportedRuntime version="v2.0.50727"/> 
    </startup> 
</configuration>

3- Enjoy

This way, your change won't alter the whole machine.

Yannick
  • 41
  • 2
1

RE "something better" - short of PowerGUI being recompiled to target .NET 4.0 - no. Out of curiousity, what .NET 4.0 feature are you trying to access in .NET 4?

Keith Hill
  • 194,368
  • 42
  • 353
  • 369
0

I'm not a dev but maybe you create a config file for powergui. Check this page:

http://poshcode.org/1971

Shay Levy
  • 121,444
  • 32
  • 184
  • 206