How to make PG to create 4.0 runtime?

Your PowerGUI Community: Simplify your PowerShell related GUI and script editing needs.


How to make PG to create 4.0 runtime?

This question is not answered
Hello,

I'm having problem running the following lines in PowerGui:

$env:AwesomODll_path = "C:\Program Files\Prog\My DLL\AwesomO.dll"
[void][System.Reflection.Assembly]::LoadFrom($env:AwesomODll_path)

The error: "Could not load file or assembly..." ... "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded"

 - The AwesomO.dll is built on .net 4.0
 - Setup for PowerGui:

    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    </startup>

 - .net versions installed: 2, 3, 3.5, 4

The script can run in debug mode, but when I'm trying to run in external window, I get this exception

OS: W Server 2003, 32 bit

Is there way to enforce the runtime version?
Can it be some default settings on a server/registry/PowerShell?

The same setup is working fine on a different server. trying to create a new setup on new server.


Thanks!



All Replies
  • Hello Alena,

    > Ideawhen I'm trying to run in external window, I get this exception[/i]
    It is not just an external window. It is a window of a real Microsoft PowerShell console. And Microsoft PowerShell 2.0 console does not work with .NET 4. The one that does work is Microsoft PowerShell 3.0 console.
    I suppose that your different server (where this is working fine) has PowerShell 3.0 installed.
    So you can either use PowerShell 3.0 or try to find some way to run Microsoft PowerShell 2.0 console with .NET 4.