如何设置文件版本评论如何设置、版本、文件

2023-09-03 05:35:39 作者:人要活出意义

在哪里可以设置文件的版本注释..?

Where can I set the file version comments..?

我们可以通过

FileVersionInfo fv = 
System.Diagnostics.FileVersionInfo.GetVersionInfo(
                   Assembly.GetExecutingAssembly().Location);
var comment = fv.Comments;

那么如何设置它,这样我可以显示相同的地方。

Then how can I set it so that I can show the same somewhere..

推荐答案

对于.NET程序集,您可以使用设置文件版本注释的AssemblyDescriptionAttribute,您通常使用Visual Studio时放在AssemblyInfo.cs文件在您的项目。

For .NET Assemblies you can set the File Version Comments using the AssemblyDescriptionAttribute, which you usually put in the AssemblyInfo.cs file in your project when using Visual Studio.

[assembly: AssemblyDescription("The assembly does xxx by yyy")]

对于其他类型的可执行文件的文件版本是使用文件中的资源设置。

For other types of executables the file version is set using a resource in the file.

在不同的装配水平的文件版本属性映射如下:

The different assembly level File Version attributes maps as follows:

FileVersionInfo.Comments = AssemblyDescription FileVersionInfo.CompanyName = AssemblyCompany FileVersionInfo.FileDescription = AssemblyTitle FileVersionInfo.FileVersion = AssemblyFileVersion FileVersionInfo.LegalCopyright = AssemblyCopyright FileVersionInfo.LegalTrademarks = AssemblyTrademark FileVersionInfo.ProductName = AssemblyProduct FileVersionInfo.ProductVersion = AssemblyInformationalVersion