gpt4 book ai didi

c# - AssemblyInfo.cs 中需要具备什么?

转载 作者:太空狗 更新时间:2023-10-29 20:01:33 26 4
gpt4 key购买 nike

默认的 AssemblyInfo.cs 如下所示:

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Foobar")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Foobar")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e8cd5d7d-5fba-4fe1-a753-f0cc6e052bf2")]

// 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 Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

所有这一切中有什么是真正必要的?例如,如果我不需要,我可以删除 Guid 和 ComVisible,或者删除 AssemblyTrademark,因为它无论如何都是空的?

最佳答案

这只是元数据 - 本身都不是必需的

ComVisibleGuid 仅在您对程序集执行 COM 互操作时才需要。其他属性最终作为 DLL 上的元数据(通过 Windows 资源管理器中文件属性对话框的 Version 选项卡可见)。

您可以删除该文件,您的应用程序将正常编译,尽管它没有元数据并且对 COM 不可见。

关于c# - AssemblyInfo.cs 中需要具备什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12390958/

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