Skip to content

System.IO.FileLoadException when calling "import clr" in x86 build #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ChristopherHoward opened this issue Oct 14, 2014 · 1 comment

Comments

@ChristopherHoward
Copy link

I downloaded the latest source code from the "develop" branch.

I then opened pythonnet.sln, and, in the Visual Studio Configuration Manager changed the active solution configuration to "ReleaseWin" and the active solution platform to "x86".

I then rebuilt the solution, and copied Python.Runtime.dll and clr.pyd to my Python 2.7 directory (C:\Python27).

I then opened a command prompt and ran python.exe.

In the interpreter, I then entered "import clr" and got the following error:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Python.Runtime, Version=4.0.0.1, Culture=neutral, PublicKeyToken=5000fea6cba702dd' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at clrModule.initclr()

This is a clean installation of python 2.7.8. I have checked that there are no other copies of Python.Runtime.dll anywhere.

@tonyroberts
Copy link
Contributor

Build using setup.py if you're not sure what you're doing. You probably have not changed some of the project settings to reflect your version of python correctly. Building via setup.py will also copy the various output dlls into the correct place so you can install and import them, building via the solution will not.

twastvedt pushed a commit to autodesk-forks/pythonnet that referenced this issue Mar 17, 2025
* initial commit

* update

* re-write

* Update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants