2

I have just upgraded from Visual Studio 2012 to Visual Studio 2015. When I open the about box in Visual Studio, it tells me it is running .NET version 4.6.00081.

But while I seem to be able to load and run scripts within PowerShell ISE okay, running PowerShell from the command line gives me the following error.

Version v4.6.00081 of the .NET Framework is not installed and it is required to run version 3 of Windows PowerShell.

I have updated powershell.exe.config and powershell_ise.exe.config (under both the System32 and SysWow64 folders) to the following, but the error persists.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.6.00081"/>
    <supportedRuntime version="v4.0.30319"/>
  </startup>
</configuration>

I'm trying to run some existing PowerShell scripts. I'm a C# developer but I know virtually nothing about PowerShell. I've tried everything I could think of. Would love some suggestions on what else I could try.

1 Answer 1

3

The supportedRuntime element requires you to specify CLR version, while what you see in VS about dialog is the .NET Framework version. You cannot assume the two are the same thing. Remove the 4.6 line and your error should disappear.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. But I'm trying to get PowerShell to use the current version of .NET. I thought we had done that with the previous version. Also, that's how I have it on another system. Are you saying I can't do that?
@JonathanWood, if your goal is to require your app to be run only with a certain version of .NET Framework, you should specify it like this, github.com/lextm/sharpsnmplib/blob/master/Samples/CSharp/… The sku attribute is the profile this app asks for and if the profile does not exist, it falls back to the next, or when nothing more an exception is thrown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.