简体   繁体   中英

LuaInterface - Compiling under .Net 3.5 / .Net 4.0 FileLoadException

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM