主程序是别人开发的(exe),允许加载.net2.0/3.5的dll,但是加载4.0的dll报错
LoadFrom报错:
Could not load file or assembly 'file:///E:\MyDocuments\Visual Studio 2010\Projects\NX6_Open_CS_Wizard1\TestC\bin\Debug\TestC.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Assembly.LoadFile报错:
ex = {"This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. (Exception from HRESULT: 0x8013101B)"}我现在已经实现了.net2.0/3.5的exe调用4.0的dll,使用配置文件,指定
<configuration>
...
<startup>
      <requiredRuntime version="4.0.30319" safemode="true"/>
</startup>
...
</configuration>因为只能开发dll调用,问题就来了。主要问题是.net2.0/3.5的dll不能使用配置
它不能引用4.0的dll,用反射调用就说运行时库比现在的高
用COM说不能引用
至于CLR HostAPI,实在有点麻烦但是我真的很想实现对4.0的dll的调用,应为这个dll不是我写的,没有代码(混淆过)。我想问问高人,这种情况下能否使用AppDomain应用程序域?
应用程序域可不可以加载配置文件,调用4.0的dll?真的真的很想实现这个调用!