[Python.NET] This assembly is built by a runtime newer than t he currently loaded runtime

Barton barton at BCDesignsWell.com
Sun Sep 19 17:59:32 CEST 2010


  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 - PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet
>


More information about the PythonDotNet mailing list