Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
588 views
in Technique[技术] by (71.8m points)

.net - AssemblyVersion,AssemblyFileVersion和AssemblyInformationalVersion之间有什么区别?(What are differences between AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion?)

There are three assembly version attributes.

(有三个程序集版本属性。)

What are differences?

(有什么区别?)

Is it ok if I use AssemblyVersion and ignore the rest?

(如果我使用AssemblyVersion并忽略其余部分,这样可以吗?)


MSDN says:

(MSDN说:)

  • AssemblyVersion :

    (AssemblyVersion :)

    Specifies the version of the assembly being attributed.

    (指定要归属的程序集的版本。)

  • AssemblyFileVersion :

    (AssemblyFileVersion :)

    Instructs a compiler to use a specific version number for the Win32 file version resource.

    (指示编译器使用Win32文件版本资源的特定版本号。)

    The Win32 file version is not required to be the same as the assembly's version number.

    (Win32文件版本不需要与程序集的版本号相同。)

  • AssemblyInformationalVersion :

    (AssemblyInformationalVersion :)

    Defines additional version information for an assembly manifest.

    (定义程序集清单的其他版本信息。)


This is a follow-up to What are the best practices for using Assembly Attributes?

(这是使用装配属性的最佳做法的后续行动)

  ask by Jakub ?turc translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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!

(如果此数字更改,其他程序集必须更新其对程序集的引用!)

The AssemblyVersion is required.

(AssemblyVersion是必需的。)

I use the format: major.minor .

(我使用的格式为: major.minor 。)

This would result in:

(这将导致:)

[assembly: AssemblyVersion("1.0")]

AssemblyFileVersion

(的AssemblyFileVersion)

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.

(使用它来标记具有相同AssemblyVersion但是从不同构建生成的程序集。)

In Windows, it can be viewed in the file properties.

(在Windows中,可以在文件属性中查看它。)

If possible, let it be generated by MSBuild.

(如果可能,让它由MSBuild生成。)

The AssemblyFileVersion is optional.

(AssemblyFileVersion是可选的。)

If not given, the AssemblyVersion is used.

(如果没有给出,则使用AssemblyVersion。)

I use the format: major.minor.revision.build , where I use revision for development stage (Alpha, Beta, RC and RTM), service packs and hot fixes.

(我使用的格式为: major.minor.revision.build ,其中我使用修订版进行开发阶段(Alpha,Beta,RC和RTM),服务包和热修复。)

This would result in:

(这将导致:)

[assembly: AssemblyFileVersion("1.0.3100.1242")]

AssemblyInformationalVersion

(AssemblyInformationalVersion)

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 '.

(这个版本可以是一个字符串,比如' 1.0 Release Candidate '。)

The Code Analysis will complain about it (CA2243) -- reported to Microsoft (not fixed in VS2013).

(代码分析会抱怨它(CA2243) - 向微软报告 (未在VS2013中修复)。)

The AssemblyInformationalVersion is optional.

(AssemblyInformationalVersion是可选的。)

If not given, the AssemblyFileVersion is used.

(如果没有给出,则使用AssemblyFileVersion。)

I use the format: major.minor [revision as string] .

(我使用格式: major.minor [revision as string] 。)

This would result in:

(这将导致:)

[assembly: AssemblyInformationalVersion("1.0 RC1")]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...