什么是使用程序集版本属性的最佳方法是什么? [英] What is the best way to use assembly versioning attributes?

查看:185
本文介绍了什么是使用程序集版本属性的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

借助的AssemblyVersion 和的 AssemblyFileVersion 属性是处理版本号为.NET程序集的内置方式。虽然框架提供有一个版本号的最低显著的部分(建立和修订,在Mi​​crosoft计算)自动决定的能力,我找到了方法,该pretty的软弱,毫无疑问,有很多人。

The AssemblyVersion and AssemblyFileVersion attributes are the built-in way of handling version numbers for .NET assemblies. While the framework provides the ability to have the least significant parts of a version number (build and revision, in Microsoft terms) automatically determined, I find the method for this pretty weak, and no doubt have many others.

所以我想问,一直立志做有版本号是更好地反映项目的实际版本的最好的工作,有什么办法?你有pre-构建脚本,设置的版本的日期和时间,或库版本为项目的工作副本的一部分?你只需要使用该框架提供的自动生成?还是其他什么东西?什么是管理组件/文件版本管理的最佳方法是什么?

So I'd like to ask, what ways have been determined to do the best job of having version numbers that better reflect the actual version of a project? Do you have a pre-build script that sets part of the version to the date and time, or repository version for your working copy of a project? Do you just use the automatic generation provided by the framework? Or something else? What's the best way to manage assembly/file versioning?

推荐答案

在我目前的项目中,我们使用Subversion的版本号为最低显著(构建)的版本号的一部分,我们使用南特脚本来创建项目集信息文件。我们使用相同的版本号为两者的AssemblyVersion和AssemblyFileVersion属性。 (其他三个部分major.minor.point,在那里为major.minor将每次有一个数据库架构的变化,并指向递增每个版本递增。)

On my current project, we use the Subversion revision number as the least significant (build) part of the version number, and we use a Nant script to create the project AssemblyInfo file. We use the same version number for both the AssemblyVersion and AssemblyFileVersion attributes. (The other three parts are major.minor.point, where major.minor will be incremented every time there's a database schema change, and point is incremented for each release.)

我们开始了内部版本号被简单地增加,但这需要的版本文件进行检查的每一个版本,并造成冲突合并时。当被证明不可行,我们开始使用CruiseControl.NET生成版本号,但是这使得它很难再现特定的手动版本。最后,我们去到目前(颠覆 - 修订)计划。

We started out with the build number being simply incremented, but that required that the version file be checked in for every build, and caused conflicts when merging. When that proved unworkable, we started using CruiseControl.NET to generate the build number, but that made it difficult to reproduce specific builds manually. Eventually we went to the current (Subversion-revision) scheme.

注:不幸的是使用.NET,这是不可能完美,从过去的版本重新构建,因为编译时的.NET编译器连接$ C C当前时间戳到目标文件$。你编译相同code每一次,你会得到一个不同的目标文件。

Note: Unfortunately with .NET, it is not possible to perfectly recreate a build from a past revision, because the .NET compilers encode the current timestamp into the object file when compiling. Every time you compile the same code, you get a different object file.

这篇关于什么是使用程序集版本属性的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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