它在AssemblyInfo.cs中为C#项目说明可以用它指定版本信息 *
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Run Code Online (Sandbox Code Playgroud)
我改成了这个:
[assembly: AssemblyVersion("1.0.*.*")]
[assembly: AssemblyFileVersion("1.0.*.*")]
Run Code Online (Sandbox Code Playgroud)
这是我从编译器得到的错误:
error CS0647: Error emitting 'System.Reflection.AssemblyVersionAttribute' attribute -- 'The version specified '1.0.*.*' is invalid'
warning CS1607: Assembly generation -- The version '1.0.*.*' specified for the 'file version' is not in the normal 'major.minor.build.revision' format
Run Code Online (Sandbox Code Playgroud)
(它甚至是什么?)它是如何工作的?
Adr*_*tti 65
"自动"内部版本号的语法(请参阅MSDN)可以是:
[assembly: AssemblyVersion("1.0.0.*")]
Run Code Online (Sandbox Code Playgroud)
要么:
[assembly: AssemblyVersion("1.0.*")]
Run Code Online (Sandbox Code Playgroud)
*意味着一切都是自动的.您不能拥有自动内部版本号和固定版本号,那么此语法不正确:
[assembly: AssemblyVersion("1.0.*.0")]
Run Code Online (Sandbox Code Playgroud)
因为AssemblyFileVersionAttribute
您不能使用*特殊字符,所以您必须提供完整有效的版本号.请注意,如果您没有提供,AssemblyFileVersionAttribute
那么您将FileVersionInfo
自动获得权利(使用相同版本AssemblyVersionAttribute
).只有在需要设置其他版本时才需要指定该属性.
cha*_*mos 27
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.*")]
Run Code Online (Sandbox Code Playgroud)
只记得注释AssemblyFileVersion行,否则自动生成的程序集版本将始终为"1.0.0.0".
那么为什么提供的评论说
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Run Code Online (Sandbox Code Playgroud)
但构建生成 CS8357?有人没有收到备忘录。
Work around:
1. Close all open documents
2. In the Solution Explorer, right-click the Project and select Unload Project
3. In the Solution Explorer, right-click the Project (now marked as unavailable) and select Edit to access the `.CSPROJ` file
4. In the opened window, find `<Deterministic>true</Deterministic>` and change it to `<Deterministic>false</Deterministic>`
5. Save the file and ensure that the edit window is closed
6. In the Solution Explorer, right-click the Project and select Reload Project
Your build (should then) work. :)
Run Code Online (Sandbox Code Playgroud)
在我看来,使用[assembly: AssemblyVersion("x.y.z.*")]
,Patch
不应自动编号。例如:
[assembly:AssemblyVersion(“ 1.2.3。*”)]
在中使用'*' AssemblyVersion
是很好的,但是请遵循seever.org,我们应该使用版本结构中*
的revision
部分<major version>.<minor version>.<build number>.<revision>
)。
给定版本号MAJOR.MINOR.PATCH,增加:
当您进行不兼容的API更改时的主要版本,
MINOR版本,当您以向后兼容的方式添加功能时,以及
进行向后兼容的错误修复时的PATCH版本。