System.data.sqlite Badimageformatexception With Nhibernate, Works Finewhen Standalone
I tried to use NHibernate with SQLite, version=1.0.74.0 for .NET 4 and 32 bit. I use a 64bit WIN7, but build the application in x86 mode (default in VS2010 express). When I use th
Solution 1:
If VS express does not allow you to choose a platform you can try setting it up manually in .csproj file
<PlatformTarget>x86</PlatformTarget>After building your app make sure that:
- it is executed as 32 or 64 bit app depending on what you put in PlatformTarget (using Windows Task Manager or Process Explorer)
- the right version of SQLite.Interop.dll is copied to the folder where you have your exe (this dll is platform dependent, so you need to copy the version corresponding to EXE platform)
- Corresponding version of Visual C++ 2010 SP1 Redistributable Package is installed
Also try removing useLegacyV2RuntimeActivationPolicy from config.
From BadImageFormatException doc:
... A DLL or executable is loaded as a 64-bit assembly, but it contains 32-bit features or resources. For example, it relies on COM interop or calls methods in a 32-bit dynamic link library. ... To address this exception, set the project's Platform target property to x86 (instead of x64 or AnyCPU) and recompile.
Post a Comment for "System.data.sqlite Badimageformatexception With Nhibernate, Works Finewhen Standalone"