我只是想知道如何使用Visual Studio(2005)自动增加文件的构建(和版本?)

如果我查找C:\Windows\notepad.exe的属性,版本选项卡给出“文件版本:5.1.2600.2180”。我想在我的dll的版本中也得到这些很酷的数字,而不是版本1.0.0.0,让我们面对它有点沉闷。

我尝试了一些东西,但它似乎没有开箱即用的功能,或者可能我只是在错误的地方(像往常一样)。

我主要工作与网络项目....

我看了两个:

http://www.codeproject.com/KB/dotnet/Auto_Increment_Version.aspx http://www.codeproject.com/KB/dotnet/build_versioning.aspx

我不敢相信花这么大力气做一件事是标准做法。

编辑: 据我所知,它在VS2005中不工作(http://www.codeproject.com/KB/dotnet/AutoIncrementVersion.aspx)


当前回答

如其他文章所述,在AssemblyInfo中的版本号中或在项目属性下设置*并不适用于所有版本的Visual Studio / . net。

Afaik,它在2005年的比赛中不起作用(但在2003年和2008年的比赛中不起作用)。对于VS 2005,你可以使用以下方法:在编译时自动增加Visual Studio 2005版本的构建和修订号。

But be aware that changing the version number automatically is not recommended for strong-named assemblies. The reason is that all references to such an assembly must be updated each time the referenced assembly is rebuilt due to the fact that strong-named assembly references are always a reference to a specific assembly version. Microsoft themselves change the version number of the .NET Framework assemblies only if there are changes in interfaces. (NB: I'm still searching for the link in MSDN where I read that.)

其他回答

设置版本号为“1.0”。*”,它会自动填充最后两个数字的日期(天从某个点)和时间(半秒从午夜)

也许现在回答这个问题已经太迟了,但希望这能解决一些人忙碌的问题。

使用PowerShell脚本自动更改所有项目的汇编版本的方法。本文将解决您的许多问题。

每次构建时,它都会自动增加最低有效位数。

我不知道如何更新其他的,但你至少应该已经看到了……

安装构建版本增量加载项。它给了你比*选项更多的控制。

我使用这种方法https://stackoverflow.com/a/827209/3975786通过将T4模板放在“解决方案项”中,并在每个项目中使用“作为链接添加”。