AssemblyInfo版本信息星号

mar*_*are 49 .net c#

它在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).只有在需要设置其他版本时才需要指定该属性.

  • 形式XYZ*构建号的@Tommy是随机的,形式XY*版本是从参考日期开始的天数,构建是从午夜开始的秒数. (4认同)
  • 对我不起作用.DLL上的文件版本始终为1.0.0.0,DLL上的产品版本为1.0.*或1.0.0.*? (3认同)

cha*_*mos 27

[assembly: AssemblyVersion("1.0.*")] 
//[assembly: AssemblyFileVersion("1.0.*")] 
Run Code Online (Sandbox Code Playgroud)

只记得注释AssemblyFileVersion行,否则自动生成的程序集版本将始终为"1.0.0.0".

  • 是的,在我的案例中也需要注释掉第二行,以便自动编号工作 (2认同)
  • 在VS2010和之前的版本中,属性`AssemblyFileVersion`不*支持通配符.如果'AssemblyFileVersion`未被*显式设置,则它从`AssemblyVersion`属性获取其值.有关详细信息,请参阅[此答案](http://stackoverflow.com/a/15506131/1497596). (2认同)

We *_*ans 6

那么为什么提供的评论说

// 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)


fre*_*red 5

在我看来,使用[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版本。