gpt4 book ai didi

c# - 指定的版本字符串不符合要求的格式 - major[.minor[.build[.revision]]]

转载 作者:IT王子 更新时间:2023-10-29 04:01:21 29 4
gpt4 key购买 nike

我想在我们的应用程序版本后附加内部版本号。例如,1.3.0.201606071

在 AssemblyInfo 中进行设置时,出现以下编译错误:

Error CS7034 The specified version string does not conform to the required format - major[.minor[.build[.revision]]]

装配信息:

[assembly:System.Reflection.AssemblyFileVersionAttribute("1.0.0.201606071")]
[assembly:System.Reflection.AssemblyVersionAttribute("1.0.0.201606071")]
[assembly:System.Reflection.AssemblyInformationalVersionAttribute("1.0.0.201606071")]

为什么会这样?

最佳答案

如您所见here,其中任一部分的最大值为 65534 .这是操作系统强加的限制,因此甚至不特定于 .NET。 Windows 将版本号放入两个整数中,它们一起形成四个无符号短整型。

Adding some metadata to it (我猜对于 * 选项)使最大允许值 UInt16.MaxValue - 1 = 65534(感谢 Gary Walker 注意到):

All components of the version must be integers greater than or equal to 0. Metadata restricts the major, minor, build, and revision components for an assembly to a maximum value of UInt16.MaxValue - 1. If a component exceeds this value, a compilation error occurs.

您的 201606071 超出了这个限制。

关于c# - 指定的版本字符串不符合要求的格式 - major[.minor[.build[.revision]]],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37941195/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com