0
votes

I have create a C# dll project that has dependencies (dlls). I am compiling the C# dll successfully and using jni4net to generate dlls and jar file that I need use in java. The jar files and dlls are genereted successfully but when I run the java code I am getting this error. "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." My question is how can I include the App.config file in the proxygen.exe to resolve this error. My app.config file in C# project is

<?xml version="1.0" encoding="utf-8" ?>

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup> 
</configuration>

I need the generated dlls from proxygen.exe to read the config file. Here is my java code

Bridge.setVerbose(false);
                Bridge.setDebug(true);
                Bridge.init();

                Bridge.LoadAndRegisterAssemblyFrom(new File(""));//path to the generated dll from proxygen.exe

                CsharpClass op=new CsharpClass();
1

1 Answers

0
votes

In your Java add Bridge.setClrVersion("v20");

Or you need to set your C# compiler to compile for .NET 4.0

See also https://github.com/jni4net/jni4net/blob/master/content/samples/runtimeSelection/