.NET assembly loading priorities

孤街浪徒 提交于 2019-11-30 01:55:33

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).

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.

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.

Yes it check the GAC first. The loading rules are documented here. To fix your problem you should update the assembly version as you change the API.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!