使用Visual Studio的时候我可以自动递增文件构建版本? [英] Can I automatically increment the file build version when using Visual Studio?
问题描述
我只是想知道我怎么会的自动的递增构建(及版本?)我的文件使用Visual Studio(2005年)。
I was just wondering how I could automatically increment the build (and version?) of my files using Visual Studio (2005).
如果我仰望发言权的属性 C:\\ WINDOWS \\ NOTEPAD.EXE
,版本选项卡提供了文件版本:5.1.2600.2180。我想在版本,以获得这些很酷的数字我的DLL太不1.0.0.0版本,这让我们面对它是一个有点沉闷。
If I look up the properties of say C:\Windows\notepad.exe
, the Version tab gives "File version: 5.1.2600.2180". I would like to get these cool numbers in the version of my dll's too, not version 1.0.0.0, which let's face it is a bit dull.
我尝试了一些东西,但它似乎没有出的现成功能,或者也许我只是找错了地方(像往常一样)。
I tried a few things, but it doesn't seem to be out-of-box functionality, or maybe I'm just looking in the wrong place (as usual).
我一起工作的主要Web项目....
I work with mainly web projects....
我看着两个:
- http://www.$c$cproject.com/KB/dotnet/Auto_Increment_Version.aspx
- http://www.$c$cproject.com/KB/dotnet/build_versioning.aspx
和我简直不敢相信那么大的力气做的事情是标准的做法。
and I couldn't believe it so much effort to do something is standard practice.
编辑:
它不会在VS2005的工作,据我可以告诉(HTTP://www.$c$cproject.com/KB/dotnet/AutoIncrementVersion.aspx)
推荐答案
在Visual Studio 2008中,下面的工作。
In visual Studio 2008, the following works.
查找AssemblyInfo.cs文件并找到这两条线:
Find the AssemblyInfo.cs file and find these 2 lines:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
您可以试试这个更改为:
You could try changing this to:
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]
但是,这不会给你想要的结果,你最终会与产品的 1.0版本。* 和文件版本的 1.0.0.0 。不是你想要的!
But this won't give you the desired result, you will end up with a Product Version of 1.0.* and a File Version of 1.0.0.0. Not what you want!
但是,如果您删除这些行的第二和公正的有:
However, if you remove the second of these lines and just have:
[assembly: AssemblyVersion("1.0.*")]
那么编译器将设置文件版本是相等的产品版本,你会得到一个自动递增的产品和文件版本,在同步你想要的结果。例如。 1.0.3266.92689
这篇关于使用Visual Studio的时候我可以自动递增文件构建版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!