My Problem:
I have a signed assembly A.dll that it versioned as 1.0.0.0 I have another assembly (lets say B.dll) that references A.dll.
Once both assemblies both assemblies load fine without any problem. Now if the version for A.dll changes to 1.0.0.1 and is recompiled Does B.dll have to be recompiled?
I asking because I have this exact scenario where after A.dll had it's version changed I now receive the following Exception trying to load B.dll:
Unhandled Exception: System.IO.FileLoadException:
Could not load file or assembly A, Version=1.0.0.0,
Culture=neutral, PublicKeyToken…
This makes me think that the answer to this question is always yes. However I have another example where I have two assemblies that have the exact scenario described above and I do not have any problem loading the assemblies.
What scenario/conditions cause this exception? If anyone can offer some insight to this it would be greatly appreciated. Thanks.
Whether or not the assembly A is signed does not necessarily matter. Did you compile with 'Specific Version = true' on project B's assembly reference to A? If so, then the CLR will use strict rules to determine whether a given version of A is acceptable. If not, then the CLR will use less strict rules, and you won't need to recompile if A increments its version.
Depending on your environment, you may not be concerned that A will break compatibility in a future version. If it's not a concern for you, then you should change your assembly references to 'Specific Version = false'. (At work, we have both situations: when we depend on a 3rd-party control, for example, we generally force 'Specific Version = true', but when we're consuming an in-house shared component that we will test against the applications which use it, we'll make sure 'Specific Version = false' so we do not need to recompile.)
You can find more information, including how to circumvent this via configuration files when you do have to compile against a specific version but want to redirect bindings later, on MSDN: Redirecting Assembly Versions
Hope that helps!