I have a solution with 3 projects (GUI, BL and DAL). The DAL assembly is signed and deployed in the 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?
I realized that because the version in the GAC was not the latest one and some methods were missing, although it compiled fine.
Does the GAC have priority over the local bin folder?
Tks in advance
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.
精彩评论