什么是的AssemblyVersion,AssemblyFileVersion和AssemblyInformationalVersion之间的差异? [英] What are differences between AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion?

查看:973
本文介绍了什么是的AssemblyVersion,AssemblyFileVersion和AssemblyInformationalVersion之间的差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有三个程序集版本属性。有什么区别?它是确定,如果我使用的AssemblyVersion,而忽略了其他人呢?


MSDN说:

  • <一个href="http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.aspx">AssemblyVersion:

      

    指定的程序集的版本被归于。

  • <一个href="http://msdn.microsoft.com/en-us/library/system.reflection.assemblyfileversionattribute.aspx">AssemblyFileVersion:

      

    指示编译器使用特定的版本号为Win32文件版本资源。在Win32文件版本不要求是相同的组件的版本号。

  • <一个href="http://msdn.microsoft.com/en-us/library/system.reflection.assemblyinformationalversionattribute.aspx">AssemblyInformationalVersion:

      

    定义其他版本信息为程序集清单。


这是跟进<一个href="http://stackoverflow.com/questions/62353/what-are-the-best-practices-for-using-assembly-attributes">What是使用程序集属性的最佳做法?

解决方案

的AssemblyVersion

在哪里引用您的程序集将寻找其他的组件。如果这个数字的变化,其他程序集必须更新其引用的程序集!所述的AssemblyVersion是必需的。

我使用的格式:为major.minor 的。这将导致:

  [总成:的AssemblyVersion(1.0)
 

AssemblyFileVersion

用于进行部署。您可以增加这个数字为每个部署。它由安装程序。用它来标记具有相同的AssemblyVersion,但来自不同生成构建组件。

在Windows中,它可以在文件属性被观看。

如果可能的话,让它被MSBuild的生成。所述AssemblyFileVersion是可选的。如果没有给出,的AssemblyVersion被使用。

我使用的格式: major.minor.revision.build 的,在这里我用修订的发展阶段(α,β,RC和RTM),Service Pack和热修复程序。这将导致:

  [总成:AssemblyFileVersion(1.0.3100.1242)
 

AssemblyInformationalVersion

组装的产品版本。这是当与客户交谈,或显示在您的网站,你会使用的版本。该版本可以是一个字符串,如 1.0候选发布版的。不幸的是,当你使用一个字符串,它会生成一个虚假的警告 - 已<一href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=275197">reported微软(固定在VS2010)。另外,code分析会抱怨它(CA2243) - <一href="http://connect.microsoft.com/VisualStudio/feedback/details/796535/the-ca2243-rule-attribute-string-literals-should-parse-correctly-should-not-be-applied-to-assemblyinformationalversionattrubute">reported微软(不固定在VS2013)。所述AssemblyInformationalVersion是可选的。如果没有给出,的AssemblyVersion被使用。

我使用的格式:为major.minor [修订作为字符串] 的。这将导致:

  [总成:AssemblyInformationalVersion(1.0 RC1)
 

There are three assembly version attributes. What are differences? Is it ok if I use AssemblyVersion and ignore the rest?


MSDN says:

  • AssemblyVersion:

    Specifies the version of the assembly being attributed.

  • AssemblyFileVersion:

    Instructs a compiler to use a specific version number for the Win32 file version resource. The Win32 file version is not required to be the same as the assembly's version number.

  • AssemblyInformationalVersion:

    Defines additional version information for an assembly manifest.


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

解决方案

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.

I use the format: major.minor. This would result in:

[assembly: AssemblyVersion("1.0")]

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.

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

If possible, let it be generated by MSBuild. The AssemblyFileVersion is optional. If not given, the AssemblyVersion is used.

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. This would result in:

[assembly: AssemblyFileVersion("1.0.3100.1242")]

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'. Unfortunately, when you use a string, it will generate a false warning -- already reported to Microsoft (fixed in VS2010). Also the Code Analysis will complain about it (CA2243) -- reported to Microsoft (not fixed in VS2013). The AssemblyInformationalVersion is optional. If not given, the AssemblyVersion is used.

I use the format: major.minor [revision as string]. This would result in:

[assembly: AssemblyInformationalVersion("1.0 RC1")]

这篇关于什么是的AssemblyVersion,AssemblyFileVersion和AssemblyInformationalVersion之间的差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆