自动增加AssemblyFileVersion [英] Automatic increase AssemblyFileVersion
问题描述
如何通过1增加自动值
[assembly:AssemblyVersion(1.0.0.1)]
[assembly: AssemblyFileVersion(1.0.0.1)]
版本
升级代码
在每个版本中......
谢谢
How to increase automatic by "1"
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]
Version
Upgrade Code
In each build...
Thanks
推荐答案
使用内置的东西,你不能,因为使用1.0 。*或1.0.0。*将使用编码日期/时间戳替换修订版本和内部编号,这通常也是一种好方法。
欲了解更多信息,请参阅汇编链接器 [ ^ ] / v标签中的文档。
至于自动递增数字,请使用AssemblyInfo任务:
AssemblyInfo任务 [ ^ ]
这可以配置为自动增加内置号码。
有2个问题:
版本字符串中的4个数字中的每一个都是限制为65535.这是一个Windows限制,不太可能得到修复。
为什么内部版本号限制为65535? [ ^ ]
与Subversion一起使用需要进行一些小改动:
使用MSBuild在构建时生成程序集版本信息(包括SubVersion修复) [ ^ ]
检索版本号非常简单:
With the "Built in" stuff, you can't, as using 1.0.* or 1.0.0.* will replace the revision and build numbers with a coded date/timestamp, which is usually also a good way.
For more info, see the Assembly Linker[^] Documentation in the /v tag.
As for automatically incrementing numbers, use the AssemblyInfo Task:
AssemblyInfo Task[^]
This can be configured to automatically increment the build number.
There are 2 Gotchas:
Each of the 4 numbers in the Version string is limited to 65535. This is a Windows Limitation and unlikely to get fixed.
Why are build numbers limited to 65535? [^]
Using with with Subversion requires a small change:
Using MSBuild to generate assembly version info at build time (including SubVersion fix)[^]
Retrieving the Version number is then quite easy:
Version v = Assembly.GetExecutingAssembly().GetName().Version;
string About = string.Format(CultureInfo.InvariantCulture, @"YourApp Version {0}.{1}.{2} (r{3})", v.Major, v.Minor, v.Build, v.Revision);
删除行
Remove the line
[assembly: AssemblyFileVersion("1.0.0.1")]
并将AssemblyVersion修改为
and modify the AssemblyVersion to
[assembly: AssemblyVersion("1.0.*")]
这将按以下格式创建一个版本:
1.0。{date}。{time}
(这并不意味着它是一个人类可读的日期,但是每个版本都会有更高的版本)
和 AssemblyFileVersion
wil l然后和 AssemblyVersion
相同我认为Visual Studio不提供类似的东西这本身就是你可能不得不寻找第三方产品,将版本增加另一个值而不是相关的日期/时间。
你可能想看看 http://autobuildversion.codeplex.com/ [ ^ ]
This will create a Version in the following format:
1.0.{date}.{time}
(this does not mean it is a human readable date, however each build will have a higher version)
And the AssemblyFileVersion
will then be the same as the AssemblyVersion
other than that I believe Visual Studio doesn't offer anything like that itself so you might have to look for 3rd party products to increment the version by another value other than date/time related.
You might want to take a look at http://autobuildversion.codeplex.com/[^]
您还可以使用Addin for Visual Studio为每个主要,次要,构建或修订号设置不同的自动增量样式。
参考这里
http:// autobuildversion。 codeplex.com/ [ ^ ]
You can also use Addin for Visual Studio to set different auto increment styles per major, minor, build or revision number.
Refer here
http://autobuildversion.codeplex.com/[^]
>
这篇关于自动增加AssemblyFileVersion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!