问题描述
有三个程序集版本属性.什么是差异?如果我使用 AssemblyVersion
并忽略其余部分可以吗?
There are three assembly version attributes. What are differences? Is it ok if I use AssemblyVersion
and ignore the rest?
MSDN 说:
指定要归因的程序集的版本.
指示编译器使用 Win32 文件版本资源的特定版本号.Win32 文件版本不需要与程序集的版本号相同.
为程序集清单定义附加版本信息.
推荐答案
AssemblyVersion
引用您的程序集的其他程序集将在哪里查看.如果这个数字发生变化,其他程序集必须更新它们对您的程序集的引用!仅更新此版本,如果它破坏了向后兼容性.AssemblyVersion
是必需的.
Where other assemblies that reference your assembly will look. If this number changes, other assemblies have to update their references to your assembly! Only update this version, if it breaks backward compatibility. The AssemblyVersion
is required.
我使用格式:major.minor.这将导致:
I use the format: major.minor. This would result in:
[assembly: AssemblyVersion("1.0")]
如果您严格遵循 SemVer,那么这意味着您仅在主要更改,因此 1.0、2.0、3.0 等
If you're following SemVer strictly then this means you only update when the major changes, so 1.0, 2.0, 3.0, etc.
AssemblyFileVersion
用于部署.您可以为每次部署增加此数字.它由安装程序使用.使用它来标记具有相同 AssemblyVersion
但从不同版本生成的程序集.
Used for deployment. You can increase this number for every deployment. It is used by setup programs. Use it to mark assemblies that have the same AssemblyVersion
, but are generated from different builds.
在 Windows 中,可以在文件属性中查看.
In Windows, it can be viewed in the file properties.
AssemblyFileVersion 是可选的.如果未给出,则使用 AssemblyVersion.
The AssemblyFileVersion is optional. If not given, the AssemblyVersion is used.
我使用格式:major.minor.patch.build,我在其中遵循 SemVer 对于前三个部分,最后一部分使用 buildserver 的 buildnumber(本地构建为 0).这将导致:
I use the format: major.minor.patch.build, where I follow SemVer for the first three parts and use the buildnumber of the buildserver for the last part (0 for local build). This would result in:
[assembly: AssemblyFileVersion("1.3.2.254")]
请注意,System.Version 将这些部分命名为major.minor.build.revision
!
Be aware that System.Version names these parts as major.minor.build.revision
!
装配信息版本
程序集的产品版本.这是您在与客户交谈或在您的网站上显示时使用的版本.这个版本可以是一个字符串,比如1.0 Release Candidate".
The Product version of the assembly. This is the version you would use when talking to customers or for display on your website. This version can be a string, like '1.0 Release Candidate'.
AssemblyInformationalVersion
是可选的.如果未给出,则使用 AssemblyFileVersion.
The AssemblyInformationalVersion
is optional. If not given, the AssemblyFileVersion is used.
我使用格式:major.minor[.patch] [revision as string].这将导致:
I use the format: major.minor[.patch] [revision as string]. This would result in:
[assembly: AssemblyInformationalVersion("1.0 RC1")]
这篇关于AssemblyVersion、AssemblyFileVersion 和 AssemblyInformationalVersion 之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!