Reputation: 855
This page http://support.microsoft.com/kb/556041 clearly explains the difference between AssemblyVersion and AssemblyFile version.
And also this page says when to change both. Still I have a question,
Assume I delivered a dot net component with Assembly version ver 1, now since its a frequent change I am changing only AssemblyFileVersion. Then I am copying my new component, how CLR will get to know my assembly Version not get changed. Now both the components (old and new) has same assemblyVersions, So How CLR will identify which component to use?
Upvotes: 0
Views: 106
Reputation: 941337
The CLR does not pay attention to the [AssemblyFileVersion]. It is only a reference number, you can see it in Windows Explorer for example. The usual approach is that you increment it when you rebuild the assembly before you ship it. The way to keep minor bug fixes separated.
The big dog is [AssemblyVersion], the CLR pays lots of attention to that one. When it finds an assembly at runtime, that version must match the reference assembly that you built your program with. If it doesn't then CLR assumes DLL Hell occurred and refuses to run the program. It is also important for the GAC, you can store multiple DLLs there with the same name but different versions. Which is a DLL Hell countermeasure.
So it is essential that you increment [AssemblyVersion] when you make a breaking change in the public interface for an assembly. The kind of chance that would make a program that uses the assembly fail if it isn't recompiled or otherwise tweaked to deal with the changes. So the user will get a clear error message, not some kind of difficult to diagnose exception. Or worse, no exception at all but just undiagnosable misbehavior.
It is up to you to ensure that the [AssemblyVersion] gets incremented. Actually doing so is not that easy, lots of companies just automatically increment [AssemblyVersion] when they release an update, even if there were no changes or the changes are not breaking. Supported by .NET by using an asterisk (*) in the attribute. It is safer that way. But then with the additional requirement that any dependent programs are updated as well. Which is certainly not unusual.
Upvotes: 1