Scott Lawrence
Scott Lawrence

Reputation: 7243

How do I run PowerShell scripts in debug mode in PowerGUI under .NET 4 Framework?

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?

Upvotes: 1

Views: 2152

Answers (3)

Yannick
Yannick

Reputation: 41

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.

Upvotes: 4

Keith Hill
Keith Hill

Reputation: 201922

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?

Upvotes: 1

Shay Levy
Shay Levy

Reputation: 126892

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

http://poshcode.org/1971

Upvotes: 0

Related Questions