Welcome to Powergui.org - an open source community for Windows Powershell

PowerGUI.org PowerGUI.org and blogs

Forums » PowerGUI User Discussions

Thread: How to make PG to create 4.0 runtime?

This question is not answered. Helpful answers available: 2. Answered answers available: 1.


Permlink Replies: 1 - Pages: 1 - Last Post: Mar 4, 2013 5:48 AM by: Mikhail Trukhma...
Alena

Posts: 1
Registered: 3/2/13
How to make PG to create 4.0 runtime?
Posted: Mar 2, 2013 7:51 AM
 
  Click to reply to this thread Reply

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!






Mikhail Trukhmanov

Posts: 45
Registered: 3/1/07
Re: How to make PG to create 4.0 runtime?
Posted: Mar 4, 2013 5:48 AM   in response to: Alena
 
  Click to reply to this thread Reply

Hello Alena,

> when I'm trying to run in external window, I get this exception
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.


Legend
MVP: 2501 + pts
Guru: 2001 - 2500 pts
Expert: 751 - 2000 pts
Enthusiast: 31 - 750 pts
Novice: 0 - 30 pts
Moderators
Helpful answer (5 pts)
Answered (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums