[英]How can a c++ exe locate a c# dll?
I am trying to run a c++ application that uses ac# dll. 我正在尝试运行使用ac#dll的C ++应用程序。 I created a clr wrapper class so that the c++ exe can load the c# dll.
我创建了一个clr包装器类,以便c ++ exe可以加载c#dll。 When I run the exe from the same directory where the c# dll is located, the application runs fine.
当我从C#dll所在的目录运行exe时,应用程序运行良好。
But, what I would like to do is to put all my application's dlls in another directory. 但是,我想做的是将所有应用程序的dll放在另一个目录中。 so my question is:
所以我的问题是:
How can I put the c# dll in a different directory from where my c++ app is located, and enable the exe to load that dll? 如何将c#dll放在与我的c ++应用程序所在的目录不同的目录中,并允许exe加载该dll?
I believe there is an option to use a configuration file, but I do not understand how exactly this is done. 我相信可以使用配置文件,但是我不知道该怎么做。
Can anyone explain the way it can be achieved? 谁能解释它的实现方式?
If the dll's directory is a subdirectory of the executable, you may use <probing>
element of your app.config: 如果dll的目录是可执行文件的子目录,则可以使用app.config的
<probing>
元素 :
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="dll_subdirectory_name"/>
</assemblyBinding>
</runtime>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.