CS1607:为“文件版本”指定的版本不在正常的“main .minor.build”中。在。net修订的格式

时间:2022-09-01 23:09:46

I am trying to set my AssemblyVersion and AssemblyFileVersion attributes in my project like so:

我正在尝试在我的项目中设置我的汇编版本和汇编文件版本属性,如下所示:

[assembly: AssemblyVersion("3.0.*")]
[assembly: AssemblyFileVersion("3.0.*")]

but I get this warning:

但我得到了这个警告:

CS1607: Assembly generation -- The version '3.0.*' specified for the 'file version' is not in the normal 'major.minor.build.revision' format

CS1607:汇编生成——版本3.0。*为“文件版本”指定的' '不在正常的'major.minor.build中。修订的形式

On the AssemblyVersionAttribute Class page at MSDN is the following:

MSDN上的assembly yversionattribute类页面如下:

You can specify all the values or you can accept the default build number, revision number, or both by using an asterisk (*). For example, [assembly:AssemblyVersion("2.3.25.1")] indicates 2 as the major version, 3 as the minor version, 25 as the build number, and 1 as the revision number. A version number such as [assembly:AssemblyVersion("1.2.*")] specifies 1 as the major version, 2 as the minor version, and accepts the default build and revision numbers. A version number such as [assembly:AssemblyVersion("1.2.15.*")] specifies 1 as the major version, 2 as the minor version, 15 as the build number, and accepts the default revision number.

您可以指定所有的值,也可以使用星号(*)接受默认的构建号、修订号或两者都接受。例如,[assembly: assembly: assembly: assembly version(“2.3.25.1”)]指出2是主要版本,3是次要版本,25是构建号,1是修订号。版本号如[assembly: assembly: assembly . version("1.2.*")]指定1为主要版本,2为次要版本,并接受默认的构建和修订号。一个版本号,例如[assembly: assembly: assembly - version("1.2.15.*")]指定1作为主要版本,2作为次要版本,15作为构建编号,并接受缺省修订号。

Note the bold section. Does anyone know why [assembly: AssemblyVersion("3.0.*")] (from my project) is not valid, but [assembly:AssemblyVersion("1.2.*")] (from the MSDN example) is valid?

注意粗体部分。有人知道为什么(来自我的项目)[assembly: assembly: assembly version(“3.0.*”)]无效,但是[assembly: assembly: assembly: version(“1.2.*”)](来自MSDN示例)有效吗?

In particular, I am curious to know if I can start with a non-zero major number, as the application that I am writing is version 3 of the program.

我特别想知道,我是否可以从一个非零的主数字开始,因为我正在编写的应用程序是该程序的第三版。

UPDATE >>> Sorry, this does seem to be answered in the other post... please vote to close it, thanks.

更新>>>对不起,这似乎在另一篇文章中得到了回答……请投票结束,谢谢。

1 个解决方案

#1


63  

You're assuming that the problem is with this line:

你假设问题出在这一行:

[assembly: AssemblyVersion("3.0.*")]

when it is actually with this one:

当它与这个

[assembly: AssemblyFileVersion("3.0.*")]

Like the accepted answer to the question that you say is not a duplicate of this one says:

就像你所说的那个被接受的答案不是这个问题的重复一样

For the AssemblyFileVersionAttribute you cannot use the * special character so you have to provide a full and valid version number.

对于assembly yfileversionattribute,不能使用*特殊字符,因此必须提供完整和有效的版本号。

That * syntax works only with the AssemblyVersion attribute. It doesn't work with the AssemblyFileVersion attribute.

该*语法只适用于程序集版本属性。它不能使用assembly yfileversion属性。

There are two workarounds to achieve the results you probably desire here:

这里有两种方法可以实现您可能希望的结果:

  1. Simply omit the AssemblyFileVersion attribute altogether. That will cause the assembly file version information to be automatically divined from the AssemblyVersion attribute (which is the one that does support the * syntax).

    简单地忽略汇编文件版本属性。这将导致程序集文件版本信息从程序集版本属性(它确实支持*语法)自动被探测到。

  2. Break out the big guns and install the Build Version Increment add-in, which offers you more version incrementing options than you can shake a stick at.

    打开大枪,安装Build Version Increment add-in,它为您提供了更多的版本递增选项,超出了您可以使用的范围。

#1


63  

You're assuming that the problem is with this line:

你假设问题出在这一行:

[assembly: AssemblyVersion("3.0.*")]

when it is actually with this one:

当它与这个

[assembly: AssemblyFileVersion("3.0.*")]

Like the accepted answer to the question that you say is not a duplicate of this one says:

就像你所说的那个被接受的答案不是这个问题的重复一样

For the AssemblyFileVersionAttribute you cannot use the * special character so you have to provide a full and valid version number.

对于assembly yfileversionattribute,不能使用*特殊字符,因此必须提供完整和有效的版本号。

That * syntax works only with the AssemblyVersion attribute. It doesn't work with the AssemblyFileVersion attribute.

该*语法只适用于程序集版本属性。它不能使用assembly yfileversion属性。

There are two workarounds to achieve the results you probably desire here:

这里有两种方法可以实现您可能希望的结果:

  1. Simply omit the AssemblyFileVersion attribute altogether. That will cause the assembly file version information to be automatically divined from the AssemblyVersion attribute (which is the one that does support the * syntax).

    简单地忽略汇编文件版本属性。这将导致程序集文件版本信息从程序集版本属性(它确实支持*语法)自动被探测到。

  2. Break out the big guns and install the Build Version Increment add-in, which offers you more version incrementing options than you can shake a stick at.

    打开大枪,安装Build Version Increment add-in,它为您提供了更多的版本递增选项,超出了您可以使用的范围。