views:

381

answers:

1

hi guys,
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)

Q1]Suppose i have a bug fix that applied in myfile.dll. Then which version should i change?

Q2]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.

Q3] 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'.

Q4]same as Q3 but B's change should not reflect in 'A'.

Q5]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?

Q6]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?

Q7]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?

Q8]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.

If you guys have any more possibilites pls feel free to add :) if any of possibilties is invalid,just ignore ;)

thx Amitd

PS: Related to this topic net-assembly-dll-sharing-and-deploying

+2  A: 

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.

Mattias S
thx for answer.I aslo found this linkhttp://blogs.msdn.com/junfeng/archive/2004/02/14/72666.aspx"When we see the assembly already exists in GAC, we try to compare the file version of the assembly in GAC(let's call it “old” assembly), and the file version of the assembly about to install(and “new“ assembly). If the “new” assembly's file version is lower than the “old” assembly's, we will refuse to install the “new” assembly, unless you ask fusion to force install (“gacutil -if“)."
Amitd
After this answer and some research..i got the answers,,thx u :)[a]for side by side installation in GAC always change assembly version.[b]for bug fix always change assembly file version.[c]older file version is always replaced by newer if same assembly version.[d]to force replace new file version with older file version(given same assembly version) use force flag in gacutil.
Amitd