C#中:自定义组件目录 [英] C#: Custom assembly directory

查看:108
本文介绍了C#中:自定义组件目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们有一个由一个可执行文件和5库的应用程序。定期所有这些将被包含在一个目录和库将在那里被载入。

Say we have an application which consists of one executable and 5 libraries. Regularly all of these will be contained in one directory and the libraries will be loaded from there.

是否有可能这样做,我可以有例如一些库称为库一个目录,并在一个休息名为LIB2?使得应用程序目录将只包含可执行文件本身和其他组件将载于各种逻辑目录

Is it possible to do so that I can have for example some of the libraries in one directory called Lib, and the rest in one called Lib2? So that the application directory would only contain the executable itself and the other assemblies would be contained in various logical directories.

我怎样才能做到这一点?我想知道怎么做组件的装载,又是如何使应用程序的构建将装配在正确的目录。

How can I do this? And I would like to know how to do the loading of the assemblies, but also how to make the building of the application put the assemblies in the right directory.

推荐答案

您可以添加额外的搜索路径到你的app.config它看起来在装载程序集。例如:

You can add additional search paths to your app.config that it looks in to load assemblies. For example

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <probing privatePath="lib;thirdParty" />
  </assemblyBinding>
</runtime>

您可以看到更多的细节这里

You can see more details here.

这篇关于C#中:自定义组件目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆