CS1607:为“文件版本”指定的版本不在.NET中的正常“major.minor.build.revision”格式

我试图设置我的AssemblyVersion和AssemblyFileVersion属性在我的项目像这样:

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

但我得到这个警告:

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

在AssemblyVersionAttribute Class页面上,MSDN是以下内容:

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:AssemblyVersion(“3.0。*”)](从我的项目)是无效的,但[assembly:AssemblyVersion(“1.2。*”)]

特别是,我很想知道我是否可以从一个非零的主要数字开始,因为我写的应用程序是程序的版本3。

UPDATE>>>对不起,这似乎在另一个帖子回答…请投票关闭它,谢谢。

你假设问题是这行:

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

当它实际上与这一个:

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

喜欢the accepted answer to the question that you say is not a duplicate of this one说:

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

该*语法仅适用于AssemblyVersion属性。它不与AssemblyFileVersion属性一起使用。

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

>完全忽略AssemblyFileVersion属性。这将导致程序集文件版本信息从AssemblyVersion属性(这是支持*语法的属性)中自动创建。
>打破大枪并安装Build Version Increment add-in,它提供了更多的版本增量选项,你可以摇一根棒。

http://stackoverflow.com/questions/15505841/cs1607-the-version-specified-for-the-file-version-is-not-in-the-normal-major

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:CS1607:为“文件版本”指定的版本不在.NET中的正常“major.minor.build.revision”格式