Reputation: 83709
We have a web application that's deployed to many websites with only frontend changes, the shared backend portion has it's DLL in the GAC so we only have to update that one dll and all the sites get the update.
Is there a way to override the GAC with a DLL in the /bin folder to test out new features before they get released?
Upvotes: 76
Views: 59036
Reputation: 1215
I have been able to override the GAC with the assembly in the \bin folder using the <codebase>
Element.
By specifying <codebase version="1.2.3.4" href="/bin/MyAssembly.dll" />
in my web.config file I can tell my application to use this version rather than the version specified in the GAC.
You may also want to take a look at the <probing>
Element for specifying assembly locations?
Upvotes: 11
Reputation: 2041
You can view binding information in the log file using the Assembly Binding Log Viewer (Fuslogvw.exe), which is included in the Windows Software Development Kit (SDK).
s
Upvotes: 0
Reputation: 2199
I think I might be saying the same think as Adam Sills, but re-worded it for my understanding. Through my own testing, looks like this is what happens:
I hope this is correct...
Upvotes: 2
Reputation: 17062
If it has the same version number as the referenced DLL, the GAC gets used.
If you increment the version number, rebuild the website referencing the new version number, put the new version in the /bin directory, then that DLL will be used.
If you do not want to change the version number, you're pretty much out of luck.
When .NET loads strong named assemblies, first it tries to decide what version number to use. It does this via the reference first, then it looks for publisher policies, then it looks for binding redirects in the configuration file.
After it does this, it looks for the assembly in the GAC, then in any codebase specified, then it probes various file system folders for the DLL. If at any one of those steps it finds the right version assembly, it stops.
If you are not changing the version number of your strong named assembly, .NET will find the original one in the GAC and stop looking. Note that because it stops when it finds one, and because looking in the GAC is first, specifying a codebase for your assembly will do no good unless you also specify a new version number.
Upvotes: 87