.NET程序集装载的优先事项 [英] .NET assembly loading priorities

查看:129
本文介绍了.NET程序集装载的优先事项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个项目(GUI,BL和DAL)的解决方案。该DAL组件签署并部署在GAC。

I have a solution with 3 projects (GUI, BL and DAL). The DAL assembly is signed and deployed in the GAC.

当我建立了DAL编译解决方案,并放置在主项目的bin文件夹中的程序集。但是,当我运行的应用程序,它加载GAC版本,而不是本地的。这是为什么?

When I build the solution the DAL is compiled and the assembly placed in the bin folder of the main project. But when I run the application, it loads the GAC version instead of the local one. Why is this?

我意识到,因为在GAC中的版本是不是最新的,有些方法人失踪,尽管它编译罚款。

I realized that because the version in the GAC was not the latest one and some methods were missing, although it compiled fine.

请问海关总署优先于当地的bin文件夹?

Does the GAC have priority over the local bin folder?

韩国社交协会提前

推荐答案

简短的回答,海关总署有precedence在本地文件。
这是我们所使用的本机DLL世界(不包括在这里总是从SYSTEM32加载某些系统DLL无论什么)不同的行为。

Short answer Yes, the GAC has precedence over local files.
this is a different behavior from what we are used to in native dll world (excluding some system dlls that where always loaded from SYSTEM32 no matter what).

为什么?
试想一下,你有多个应用程序使用相同的组件,现在装配有你如何解决所有的应用程序中的错误? 它很难开始搜索上的所有驱动程序的所有应用程序,它更容易单集部署到GAC答修复一次所有的应用程序。

Why?
Imagine that you have multiple applications with the same assembly now that assembly has a bug how do you fix all of your applications? It hard to start search for all the applications on all drivers, its easier to deploy a single assembly to the GAC ans fix all the application at once.

至于你的问题,如果你改变API,您需要更改程序集版本的组件,这样一来融合引擎将拿起那就是在本地文件夹的版本。

As for your problem, if you change API you need to change the assembly version of that assembly, this way the fusion engine will pick up the version that is in the local folder.

这篇关于.NET程序集装载的优先事项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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