[Python.NET] This assembly is built by a runtime newer than t he currently loaded runtime
Dave
dave.hirschfeld at gmail.com
Tue Aug 17 10:11:30 CEST 2010
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.
More information about the PythonDotNet
mailing list