Gendarme has an AvoidAssemblyVersionMismatchRule
with the following description:
This rule checks that the
[AssemblyVersion]
matches the[AssemblyFileVersion]
when both are present inside an assembly. Having different version numbers in both attributes can be confusing once the application is deployed.
For example, this rule would warn on Microsoft's System.dll
which has the following attributes:
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.50727.3053")]
I disagree with Gendarme's rule. Following it would make it impossible to you use a versioning scheme similar to the one used by Microsoft, that is
- update
AssemblyFileVersion
on every build, - change
AssemblyVersion
only on public interface or otherwise major changes, - make sure that
AssemblyVersion
andAssemblyFileVersion
share a common prefix,
and I think this versioning scheme is the design reason why it was made possible to differentiate between AssemblyVersion
and AssemblyFileVersion
in the first place.
I cannot come up with a reason why forcing both assembly attributes to be equal is a good practice, but maybe you can! I would be interested in your opinions.
If indeed there is no good reason, I will soon suggest the Gendarme developers to change the rule to
This rule checks that the
[AssemblyVersion]
and[AssemblyFileVersion]
have a common, non-empty prefix when both are present inside an assembly.