Global assembly cache versus BIN folder.
If you are frequently updating the Assembly, then you always better to deploy it in BIN. Since, Assembly will be reloaded automatically just after the updating. But when you update the Assembly in GAC, you have to restart the IIS (IISRESET) to grab the new version. The reason is GAC keeps the assembly in Cache. You can use different versions of the same DLL across applications, but not the same dll with different versions in the same BIN.
When you deploy your Assembly on GAC then you can access the Assembly from any web application. But when you deploy Assembly in web application’s BIN folder, then it can only access from the given web application. Anyway, if you have all-purpose web part, you better to deploy it in GAC and avoid the multiple Assembly deployments in BIN.
If you have multiple versions of same Assembly used in 1 application, then you have to deploy it in GAC. Because the GAC manages the multiple version of given Assembly, but BIN doesn’t.
I found this information here.
Next question is what order will the assemblies be used. I’ve read something like .Net will look for the highest version in the BIN and GAC and use that one, or others say the BIN has priority over the GAC.
So I did the test.
First I deployed a simple website that has a textbox and a button. When you click the button you will get the assembly version of a referenced class library. I placed a version 126.96.36.199 of the dll in theGAC.
I tested 4 scenarios:
1: The class library referenced is of version 188.8.131.52 and the dll is located in the bin folder
2: The class library referenced is of version 184.108.40.206 and the dll is located in the bin folder
3: The class library referenced is of version 220.127.116.11 and the dll is NOT located in the bin folder
4: The class library referenced is of version 18.104.22.168 and the dll is NOT located in the bin folder
So the result is that the BIN folder has priority over the GAC. In example 1 we will retrieve the 22.214.171.124 version of the dll.
In the second example we will see the 126.96.36.199 version of the dll that is in the BIN folder.
Then we will get an error, since the project is build against the 188.8.131.52 and the GAC version is 184.108.40.206.
And the fourth example shows the GAC version.
There are methods to force your web application to use certain versions of dll. Adding the required version to your config file can do the trick.