GAC and Assembly Versioning [closed]
i have to deploy few assembly to GAC. I just had a few questions 开发者_如何学编程about (my) understanding of GAC. really confuses me.
I want to know which versions to change assembly and file version. What are possible combinations in which GAC dll will be replaced by installing application. and basic management for GAC files.
I will explain my question using following example for better understanding of GAC :
Suppose i have products A and B .
Both A and B refer to myfile.dll installed in GAC.
(i) assembly version : [1.0.0.0] (ii) assembly file version : [2.0.0.0] (intentionally different to avoid more confusion)Suppose i have a bug fix that applied in myfile.dll. Then which version should i change?
Suppose i have new version of A say 'ANEW' .then which version should be changed so that both A,B ANEW can reside side by side.
suppose if i have 'A' installed with myfile.dll present in GAC and now i try to install 'B' which has gac dll with bug fixes ..then which versions to change so that change reflects in 'A'.
same as Q3 but B's change should not reflect in 'A'.
Suppose 'A' is installed with myfile(1.0.0.0). Now suppose 'B' is installing with myfile(1.x.y.z).. will the GAC file be replaced?
Suppose 'A' is installed with myfile(1.0.0.0). Now suppose 'B' is installing with myfile(2.x.y.z).. will the GAC file be replaced?
Suppose 'A' is installed with myfile (1.0.0.0). Now suppose 'B' is installing with myfile(1.0.0.0) assuming the version is not changed.. will the GAC file be replaced?
Also how are GAC dlls removed .is there any criteria for removal?
I guess questions are bit confusing but hope you guys know what im asking.
PS: Related to this topic net-assembly-dll-sharing-and-deploying
1) Depends on what kind of changes you make to fix the bug. If you change any public interfaces or make significant changes to behaviour, I'd bump the assembly version number. If not, you can do what Microsoft does an only version the file.
2) Assembly version is all that the GAC cares about. So if you want two identically named assemblies to live side by side, they have to differ by assembly version.
3) I would likely change the assembly version number, and include publisher policy to redirect clients of the old version to the new.
4) Same as 3 but don't include publisher policy, or configure A to bypass it.
5) & 6) No, it's installed side by side.
7) I don't think so, but it may depend on if they differ in file version. I'm sure you can try it to verify.
8) There are references that may be used to prevent accidental removal. MSI uses that, so if you use MSI for installing, it keeps track of references to the assembly and doesn't remove it until all apps are uninstalled. If you do it manually (say using Gacutil /uf) you can screw things up.
精彩评论