.net版本号

以下转自:https://www.cnblogs.com/AllengWang/archive/2006/11/17/563660.html

我一直不太清楚AssemblyInfo.cs中AssemblyVersion AssemblyFileVersion之间的区别,今天刚好在查TFS的版本号,需要查询Microsoft.TeamFoundation.dll的版本号能过属性可以看到:


不仅有我知道的两种版本号,还有另外种版号Product Version。
Assembly Version: 8.0.0.0
File Version: 8.0.50727.83
Product Version: 8.0.50727.83

在C# Project 中通常会在Assembly.cs中定义:
[assembly: AssemblyVersion("1.1.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.2.1.0")]  // 用来定义 Product Version

AssemblyVersion is stored in the metadata table of the assembly built. It is used to uniquely identify an assembly when referenced from other assemblies. Moreover, the CLR uses this version when binding to strongly named assemblies . AssemblyFileVersion and AssemblyInformationalVersion are informational only.

一个VS.NET插件用来管理Project Version:
Versioning Controlled Build
http://www.codeproject.com/dotnet/VersioningControlledBuild.asp

网上资源
Auto Increment Build Numbers for C# Projects in VS.NET 2003
http://www.biasecurities.com/blogs/jim/archive/2003/10/08/166.aspx

Managing AssemblyVersion
http://weblogs.asp.net/sjoseph/archive/2004/02/19/76277.aspx

Using Open Source .NET Tools for Sophisticated Builds
http://www.15seconds.com/issue/040621.htm

CSDN: 自动编译,框架警察检查,文档生成,版本标注。
http://dev.csdn.net/develop/article/36/36866.shtm

UpdateVersion
http://code.mattgriffith.net/UpdateVersion/
一个工具

AssemblyVersion and Web Projects
http://odetocode.com/Blogs/scott/archive/2006/01/24/2786.aspx

*****************************************************************************

以下转自:https://bbs.csdn.net/topics/230066719

关于发布版本号管理 

标准版本号物理形式表示为用句点隔开的四段数字,如下面的代码示例所示。
<major version>.<minor version>.<build number>.<revision> 

实际使用中,我们一般只用到前面三段。即
<major version>.<minor version>.<build number>

而且会分外部版本号和内部版本号:
<Version>
    <InternalVer>2.2.2</InternalVer>
    <ExternalVer>1.1.0</ExternalVer>
</Version>

程序显示的应该是外部版本号。
程序编译前用当前的内部版本号更新 AssemblyVersion 属性的 build number 段,非程序文件(如资源等)在打包、备份、打标签时统一使用内部版本号。


每个Assebmly包含三个Version 
AssemblyFileVersion :存储在win32资源中, CLR不关心这个版本号, 
AssemblyInformationnalVersion :存储在win32资源中, CLR不关心这个版本号,此版本号用来表示包含 
Assembly的产品的版本 
AssemblyVersion: 存储在AssemblyDef manifest metadata table中,CLR会使用这个版本号 

工具的支持: 
CSC.exe和AL.exe在每次build时可以自动增加AssemblyVersion, 但要慎用.改变一个Assembly的 
AssemblyVersion会导致引用这个Assembly的其它Assembly无法工作. 

在VS会为每一个.net Porject生成 AssemblyInfo.cs 可在其中设置相关的信息. 
[assembly: AssemblyVersion(”1.0.0.0″)] 
[assembly: AssemblyFileVersion(”1.0.1.0″)] 
如果使用[assembly: AssemblyVersion(”1.0.*”)], 在每次程序修改后build或rebuild后, assembly的 
AssemblyVersion的Build Number和 ReversionNumber和会自动增加.ReversionNumber每次都变, 
Build Number随日期的变化而变化. 

有没有什么工具可以显式地设置一个solution中所有的project的AssemblyVersion? 

通过程序获得版本信息: 
//== Get File Version 
System.Diagnostics.FileVersionInfo.GetVersionInfo 

//==Get Assembly Version 
AssemblyName assName = Assembly.GetExecutingAssembly().GetName(); 
string version = assName.Version.ToString(); 

对于一个win32的exe或dll,在Explore中查看它的属性(Properties->Version)可以看到 
File Version 
Product Version

一个.net Assembly在Explore中查看它的属性(Properties->Version)可以看到 
Assebly Version (对应 AssemblyVersion) 
File Version (对应 AssemblyFileVersion) 
Product Version (对应 AssemblyInformationnalVersion, 如果不指定,则和AssemblyFileVersion对应)

猜你喜欢

转载自www.cnblogs.com/guanglin/p/12529672.html