[英]CS1607: Assembly generation — The version '1.4.0.85725' specified for the 'file version' is not in the normal 'major.minor.build.revision' format
(Please excuse me if I get any terms mixed up here - I am a Java developer, new to .Net and C#. Please add/correct any tags on this question if need be.) (请原谅我在这里混淆了任何条款 - 我是Java开发人员,对.Net和C#不熟悉。如果需要,请在此问题上添加/更正任何标签。)
I am using an MSBuild script to build my project. 我正在使用MSBuild脚本来构建我的项目。 One of the tasks is to write the assembly info:
其中一个任务是编写程序集信息:
<Target Name="UpdateAssemblyInfo">
<Message Text="Updating assemblies to file version $(AssemblyVersion) ($(AssemblyFileVersion))" Importance="high"/>
<AssemblyInfo CodeLanguage="CS"
OutputFile="SharedAssemblyInfo.cs"
AssemblyVersion="$(AssemblyVersion)"
AssemblyFileVersion="$(AssemblyFileVersion)"
AssemblyProduct="SVN revision $(BUILD_NUMBER)"/>
</Target>
This converts SharedAssemblyInfo.cs
from this: 这将转换
SharedAssemblyInfo.cs
:
[assembly: System.Reflection.AssemblyVersion("0.0.0")]
To this: 对此:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18063
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Reflection.AssemblyVersion("1.4.0")]
[assembly: System.Reflection.AssemblyFileVersion("1.4.0.85725")]
[assembly: System.Reflection.AssemblyProduct("SVN revision 85725")]
So far so good. 到现在为止还挺好。 Except I see the following message in the build log of TeamCity:
除了我在TeamCity的构建日志中看到以下消息:
CSC warning CS1607: Assembly generation -- The version '1.4.0.85725' specified for the 'file version' is not in the normal 'major.minor.build.revision' format
CSC警告CS1607:程序集生成 - 为“文件版本”指定的版本“1.4.0.85725”不是正常的“major.minor.build.revision”格式
Why am I getting this warning, when the format of the version appears to follow the format specified in the warning message? 当版本的格式符合警告消息中指定的格式时,为什么会收到此警告?
您收到错误的原因是修订号大于65534。
Why am I getting this warning, when the format of the version appears to follow the format specified in the warning message?
当版本的格式符合警告消息中指定的格式时,为什么会收到此警告?
Re-read that warning, with some added emphasis: 重新阅读该警告,并重点强调:
the normal 'major.minor.build.
正常的'major.minor.build。
revision ' format
修订 '格式
.NET version numbers have FOUR parts, not three. .NET版本号有四个部分,而不是三个。
The System.Version
type used for this will process versions of fewer types, but it is possible for code using System.Version
to check and be stricter. 用于此的
System.Version
类型将处理更少类型的版本,但使用System.Version
代码可以检查并更严格。
Additional, as noted by Mihai , elements of the version are limited to System.UInt16.MaxValue
(65535): this is a Windows API limitation (in System.Version each element is a System.Int32
) related to the native VS_FIXEDFILEINFO
1 resource that the compiler inserts into the assembly from various assembly attributes. 另外,如Mihai所述 ,该版本的元素仅限于
System.UInt16.MaxValue
(65535):这是与本机VS_FIXEDFILEINFO
1资源相关的Windows API限制(在System.Version中,每个元素是System.Int32
)编译器从各种程序集属性插入程序集。 This allows tools like Windows Explorer to read the version. 这允许Windows资源管理器等工具读取该版本。
Summary: 摘要:
1 The version is stored across two DWORD
members: one for Major and Minor parts, the other for Build and Revision (albeit not given those names in Win32). 1版本存储在两个
DWORD
成员中:一个用于主要和次要部分,另一个用于构建和修订(尽管在Win32中没有给出这些名称)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.