Svi*_*ish 7 c# attributes .net-assembly
默认的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")]
Run Code Online (Sandbox Code Playgroud)
这一切真的有必要吗?例如,我可以删除Guid和ComVisible,如果我不需要它,或者AssemblyTrademark,因为它只是空的吗?
Ode*_*ded 11
这仅仅是元数据-它都没有要求这样.
ComVisible并且Guid仅在与组件进行COM互操作时才需要.其他属性最终作为DLL上的元数据(通过VersionWindows资源管理器中文件属性对话框的选项卡可见).
您可以删除该文件,您的应用程序将编译得很好,虽然它没有元数据,也不会显示COM.