2

A project of mine utilizes LuaInterface. I've begun migrating it from XNA to OpenTX, as well as rewriting it under .Net 4.0.

I started moving my Lua class over, to find that i get an exception when debugging (FileLoadException)

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

When i rebuilt LuaInterface, i changed the .Net Framework in its properties from .Net 2.0 to .Net 4.0 (as well as its client mode) and .Net 3.5.

Both of these settings give me the error stating its still built using 2.0.

I've attempted many solutions here at StackOverflow as well as MSDN, stating to setup an app.config and even change Application Pools for some ungodly reason...

Anyway, every solution i've attempted failed, stating that its STILL using 2.0.

I've used 'IL DASM' and it states its built using 3.5/4.0.

Any ideas as to whats going on? Been messing with this all day. Am I simply being naive to think that changing a single setting could fix my problems?

Any help would be GREATLY appreciated.

rvIceBreaker
  • 21
  • 1
  • 3
  • If anyone is looking for a way to replicate the problem, just make write up a class that instantiates the Lua class in LuaInterface. The exception is thrown when that happens. – rvIceBreaker May 05 '11 at 22:05
  • http://stackoverflow.com/questions/3844057/loading-luainterface-in-net4 – sylvanaar May 06 '11 at 12:41
  • I looked at the Lua511 source before. It acts strangely, sometimes i've been able to successfully build it without any changes, sometimes there are a few 'unable to convert to ' exceptions. I don't see how that would have any effect though, seeing as how the original error is caused by the LuaInterface library. I'll play with it and see what happens... – rvIceBreaker May 08 '11 at 05:17

2 Answers2

4

I had the same problem when I tried to integrate LUA code with my .NET4.0 project. I didn't rebuild the .dll because I couldn't check-out the LuaInterface project files from their repository. Anyway, I rewrote the app.config for my small test application and it seems to work, so far.

The xml lines you need to rewrite are:

<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>

I couldn't tell you how robust this method is, since I only tried some simple stuff like read/write string, doFile, etc.

Hope it works for you as well.

Inbar Rose
  • 41,843
  • 24
  • 85
  • 131
proudnoldo
  • 41
  • 2
0

This seems to be the same problem you have (not my area, but since no one else has chipped in :-))

http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/5d1186ec-ad55-4929-b1e4-8806cdc758af

and

http://msmvps.com/blogs/rfennell/archive/2010/03/27/mixed-mode-assembly-is-built-against-version-v2-0-50727-error-using-net-4-development-web-server.aspx

hth

daven11
  • 2,905
  • 3
  • 26
  • 43
  • I've tried the second solution. The first one i'm not even sure is relevant, seeing as how i'm making a win32 application/library. – rvIceBreaker May 08 '11 at 05:14