如何在jni4net的proxygen.exe中包含App.config [英] How to include App.config in proxygen.exe of jni4net
问题描述
我创建了一个C#项目,它有几个我需要从java调用的依赖项(dll)。我正在使用jni4net来实现这一目标。我能够使用proxygen.exe生成所需的文件但是当我尝试从java调用C#函数时出现此错误。
混合模式程序集是针对版本v2.0.50727的运行时并没有额外的配置信息就无法在4.0运行时加载。
我的问题是如何包含App.config文件在执行proxygen.exe期间,生成的dll可以使用吗?
I have created a C# project which has several dependencies(dlls) that I need to call from java. I am using jni4net to accomplish this. I am able to generate required files using proxygen.exe but when I try to call the C# functions from java am getting this error.
"Mixed mode assembly is built against version v2.0.50727 of the run time and cannot be loaded in the 4.0 runtime without additional configuration information."
My question is How can I include the App.config file during execution of proxygen.exe so that the dll generated can use it?
推荐答案
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
但是,我找不到有关.NET配置文件放置位置的任何文档。我能找到的唯一参考是 2011年此主题 [ ^ ]这似乎意味着无法使用 app.config
带有jni4net应用程序的文件。
您可能需要提交有关GitHub的错误报告 [ ^ ]。
或者,您可以重建C#程序集以定位.NET 4.0或更高版本。
However, I can't find any documentation on where to put the .NET configuration file. The only reference I can find is this thread from 2011[^] which seems to imply it's not possible to use an app.config
file with a jni4net application.
You might need to file a bug report on GitHub[^].
Alternatively, you could rebuild your C# assembly to target .NET 4.0 or later.
这篇关于如何在jni4net的proxygen.exe中包含App.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!