集信息版本信息星号 [英] AssemblyInfo version information asterisks

查看:144
本文介绍了集信息版本信息星号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

报告说,在AssemblyInfo.cs中的C#项目,它可能指定版本信息 *

It says in AssemblyInfo.cs for C# projects that it's possible to specify version information with *

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

我改成了这样:

I changed it to this:

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

这是我从编译器出现错误:

and this is the error I get from the compiler:

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

如何(是否甚至?)它的工作?

How does (does it even?) it work?

推荐答案

语法(见<一href="http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.aspx">MSDN)为自动集结号可以是:

Syntax (see MSDN) for "automatic" build number can be:

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

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

<大骨节病> * 手段的之后,这一切都是自动的。你不能有自动构建号码和固定的版本号那么这个语法是不正确的:

* means after this everything is automatic. You can't have automatic build number and fixed revision number then this syntax isn't correct:

[assembly: AssemblyVersion("1.0.*.0")]

对于 AssemblyFileVersionAttribute 则不能使用<大骨节病> * 特殊字符,所以你必须提供一个完整和有效的版本号。请注意,如果您不提供 AssemblyFileVersionAttribute 那么你会得到正确的 FileVersionInfo 自动(与相同版本的 AssemblyVersionAttribute )。你只需要,如果你需要设置一个不同的版本,以指定的属性。

For the AssemblyFileVersionAttribute you cannot use the * special character so you have to provide a full and valid version number. Please note that if you do not provide an AssemblyFileVersionAttribute then you'll get the right FileVersionInfo automatically (with the same version of AssemblyVersionAttribute). You need to specify that attribute only if you need to set a different version.

这篇关于集信息版本信息星号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆