How best to use File Version and Assembly Version?
In .NET there are two version numbers available when building a project, File Version and Assembly Version. How are you using these numbers? Keeping them the same? Auto-incrementing one, but manually changing the other?
Also what about the AssemblyInformationalVersion
attribute?
I'd found this support Microsoft Knowledge Base (KB) article that provided some help: How to use Assembly Version and Assembly File Version.
在我有多个文件程序集(即1个exe和5个dll)的场景中,我将为每个文件使用不同的文件版本,但是它们都使用相同的汇编版本,从而使您可以知道每个dll所附带的exe文件。
In solutions with multiple projects, one thing I've found very helpful is to have all the AssemblyInfo files point to a single project that governs the versioning. So my AssemblyInfos have a line:
[assembly: AssemblyVersion(Foo.StaticVersion.Bar)]
I have a project with a single file that declares the string:
namespace Foo
{
public static class StaticVersion
{
public const string Bar= "3.0.216.0"; // 08/01/2008 17:28:35
}
}
My automated build process then just changes that string by pulling the most recent version from the database and incrementing the second last number.
I only change the Major build number when the featureset changes dramatically.
I don't change the file version at all.
The KB article mentions the most important distinction: File versions are only used for display purposes, whereas the assembly version plays an important part in the .NET loading behaviour.
If you change the assembly version number, then the identity of your assembly as a whole has changed. Developers will need to rebuild to reference your new version (unless you put some auto-versioning "policy" in place) and at runtime only assemblies with matching version numbers will be loaded.
This is important in my environment, where we need an incrementing, highly visible version number for audit purposes, but we don't want to force developers to rebuild or have many versions concurrently in production. In this case for backwardly-compatible minor changes we update the file version, but not the assembly version.
链接地址: http://www.djcxy.com/p/50664.html下一篇: 如何最好地使用文件版本和组件版本?