This assembly is built by a runtime newer than t he currently loaded runtime

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

This assembly is built by a runtime newer than t he currently loaded runtime

dhirschfeld
I needed to access .NET dlls compiled for .NET4 and ran into the error:

System.BadImageFormatException: This assembly is built by a runtime newer than t
he currently loaded runtime and cannot be loaded. (Exception from HRESULT: 0x801
3101B)

So I attempted to recompile PythonDotNET for .NET4. In VS2010 I changed all the
project targets to be .NET4 and it compiled fine with only a couple of errors
about System.Security.Permissions.SecurityAction.RequestMinimum being obsolete.
Unfortunately when I tried to import clr I got the following error:

SystemError: dynamic module not initialized properly

Looking further into it I found that in buildclrmodule.bat lines 33 & 66
referenced the .NET2 idalsm.exe:

%windir%\Microsoft.NET\Framework\v2.0.50727\ilasm /nologo /quiet /dll
%ILASM_EXTRA_ARGS% /include=%INCLUDE_PATH% /output=%OUTPUT_PATH% %INPUT_PATH%

I changed this to reference the .NET4 version:

%windir%\Microsoft.NET\Framework\v4.0.30319\ilasm /nologo /quiet /dll
%ILASM_EXTRA_ARGS% /include=%INCLUDE_PATH% /output=%OUTPUT_PATH% %INPUT_PATH%

...and everything works perfectly!

HTH,
Dave

NB: Apologies if this appears twice - I sent it from a different account
previously and don't think it made it through.


_________________________________________________
Python.NET mailing list - [hidden email]
http://mail.python.org/mailman/listinfo/pythondotnet
Reply | Threaded
Open this post in threaded view
|

Re: This assembly is built by a runtime newer than t he currently loaded runtime

Barton
  Has anyone noticed that buildclrmodule.bat seems to have two copies of
the exact same set of commands???


On 8/17/2010 1:11 AM, Dave wrote:

> I needed to access .NET dlls compiled for .NET4 and ran into the error:
>
> System.BadImageFormatException: This assembly is built by a runtime newer than t
> he currently loaded runtime and cannot be loaded. (Exception from HRESULT: 0x801
> 3101B)
>
> So I attempted to recompile PythonDotNET for .NET4. In VS2010 I changed all the
> project targets to be .NET4 and it compiled fine with only a couple of errors
> about System.Security.Permissions.SecurityAction.RequestMinimum being obsolete.
> Unfortunately when I tried to import clr I got the following error:
>
> SystemError: dynamic module not initialized properly
>
> Looking further into it I found that in buildclrmodule.bat lines 33&  66
> referenced the .NET2 idalsm.exe:
>
> %windir%\Microsoft.NET\Framework\v2.0.50727\ilasm /nologo /quiet /dll
> %ILASM_EXTRA_ARGS% /include=%INCLUDE_PATH% /output=%OUTPUT_PATH% %INPUT_PATH%
>
> I changed this to reference the .NET4 version:
>
> %windir%\Microsoft.NET\Framework\v4.0.30319\ilasm /nologo /quiet /dll
> %ILASM_EXTRA_ARGS% /include=%INCLUDE_PATH% /output=%OUTPUT_PATH% %INPUT_PATH%
>
> ...and everything works perfectly!
>
> HTH,
> Dave
>
> NB: Apologies if this appears twice - I sent it from a different account
> previously and don't think it made it through.
>
>
> _________________________________________________
> Python.NET mailing list - [hidden email]
> http://mail.python.org/mailman/listinfo/pythondotnet
>
_________________________________________________
Python.NET mailing list - [hidden email]
http://mail.python.org/mailman/listinfo/pythondotnet