I've inherited a .NET application that automatically updates it's version number with each release. The problem, as I see it, is the length and number of digits in the version number.
我继承了一个.NET应用程序,它会在每个版本中自动更新它的版本号。正如我所看到的,问题是版本号中的长度和位数。
An example of the current version number format is 3.5.3167.26981
which is a mouthful for the users to say when they are reporting bugs.
当前版本号格式的一个示例是3.5.3167.26981,这对用户说出何时报告错误是很满意的。
What I would like is something more like this: 3.5 (build 3198)
. I would prefer to manually update the major and minor versions, but have the build number update automatically.
我想要的是更像这样的东西:3.5(build 3198)。我更愿意手动更新主要版本和次要版本,但自动更新版本号。
Even better, I don't want the build number to increment unless I am compiling in RELEASE mode.
更好的是,除非我在RELEASE模式下编译,否则我不希望增加内部版本号。
Anyone know if there is a way to do this -- and how?
任何人都知道是否有办法做到这一点 - 以及如何做到这一点?
3 个解决方案
#1
3
In one of the project files, probably AssemblyInfo.cs, the assembly version attribute is set to [assembly: AssemblyVersion("3.5.*")]
or something similar. The * basically means it lets Visual Studio automatically set the build and revision number.
在其中一个项目文件中,可能是AssemblyInfo.cs,程序集版本属性设置为[assembly:AssemblyVersion(“3.5。*”)]或类似的东西。 *基本上意味着它允许Visual Studio自动设置构建和修订号。
You can change this to a hard coded value in the format <major version>.<minor version>.<build number>.<revision>
您可以将其更改为
You are allowed to use any or all of the precision. For instance 3.5 or 3.5.3167 or 3.5.3167.10000.
您可以使用任何或所有精度。例如3.5或3.5.3167或3.5.3167.10000。
You can also use compiler conditions to change the versioning based on whether you're doing a debug build or release build.
您还可以使用编译器条件根据您是在进行调试构建还是发布构建来更改版本控制。
#2
0
At a previous company we did something like this by writing an Ant task to get the current Subversion changeset string, which we used as the build number, appended after the major, minor, and tertiary numbers. You could do something like this with Visual Studio as well.
在之前的公司,我们做了类似的事情,编写了一个Ant任务来获取当前的Subversion变更集字符串,我们用它作为内部编号,附加在主编号,次编号和第三编号之后。您也可以使用Visual Studio执行此类操作。
#3
0
Use a '*' wildcard in the AssemblyVersion attribute. Documentation is here. Note that if the application is built from multiple assemblies, the version you care most about is the one for the .exe.
在AssemblyVersion属性中使用'*'通配符。文档在这里。请注意,如果应用程序是从多个程序集构建的,那么您最关心的版本是.exe的版本。
#1
3
In one of the project files, probably AssemblyInfo.cs, the assembly version attribute is set to [assembly: AssemblyVersion("3.5.*")]
or something similar. The * basically means it lets Visual Studio automatically set the build and revision number.
在其中一个项目文件中,可能是AssemblyInfo.cs,程序集版本属性设置为[assembly:AssemblyVersion(“3.5。*”)]或类似的东西。 *基本上意味着它允许Visual Studio自动设置构建和修订号。
You can change this to a hard coded value in the format <major version>.<minor version>.<build number>.<revision>
您可以将其更改为
You are allowed to use any or all of the precision. For instance 3.5 or 3.5.3167 or 3.5.3167.10000.
您可以使用任何或所有精度。例如3.5或3.5.3167或3.5.3167.10000。
You can also use compiler conditions to change the versioning based on whether you're doing a debug build or release build.
您还可以使用编译器条件根据您是在进行调试构建还是发布构建来更改版本控制。
#2
0
At a previous company we did something like this by writing an Ant task to get the current Subversion changeset string, which we used as the build number, appended after the major, minor, and tertiary numbers. You could do something like this with Visual Studio as well.
在之前的公司,我们做了类似的事情,编写了一个Ant任务来获取当前的Subversion变更集字符串,我们用它作为内部编号,附加在主编号,次编号和第三编号之后。您也可以使用Visual Studio执行此类操作。
#3
0
Use a '*' wildcard in the AssemblyVersion attribute. Documentation is here. Note that if the application is built from multiple assemblies, the version you care most about is the one for the .exe.
在AssemblyVersion属性中使用'*'通配符。文档在这里。请注意,如果应用程序是从多个程序集构建的,那么您最关心的版本是.exe的版本。