AssemblyTitleAttribute 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
어셈블리에 대한 설명을 지정합니다.
public ref class AssemblyTitleAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)]
public sealed class AssemblyTitleAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false)]
public sealed class AssemblyTitleAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class AssemblyTitleAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)>]
type AssemblyTitleAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false)>]
type AssemblyTitleAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type AssemblyTitleAttribute = class
inherit Attribute
Public NotInheritable Class AssemblyTitleAttribute
Inherits Attribute
- 상속
- 특성
예제
다음 예제에서는 특성을 포함하여 AssemblyTitleAttribute 특성을 동적 어셈블리에 추가하는 방법을 보여줍니다. 이 예제에서는 어셈블리를 디스크에 저장하고 Windows 파일 속성 대화 상자를 사용하여 특성 값을 볼 수 있습니다.
using System;
using System.Reflection;
using System.Reflection.Emit;
class Example
{
public static void Main()
{
AssemblyName assemName = new AssemblyName();
assemName.Name = "EmittedAssembly";
// Create a dynamic assembly in the current application ___domain,
// specifying that the assembly is to be saved.
//
AssemblyBuilder myAssembly =
AppDomain.CurrentDomain.DefineDynamicAssembly(assemName,
AssemblyBuilderAccess.Save);
// To apply an attribute to a dynamic assembly, first get the
// attribute type. The AssemblyFileVersionAttribute sets the
// File Version field on the Version tab of the Windows file
// properties dialog.
//
Type attributeType = typeof(AssemblyFileVersionAttribute);
// To identify the constructor, use an array of types representing
// the constructor's parameter types. This ctor takes a string.
//
Type[] ctorParameters = { typeof(string) };
// Get the constructor for the attribute.
//
ConstructorInfo ctor = attributeType.GetConstructor(ctorParameters);
// Pass the constructor and an array of arguments (in this case,
// an array containing a single string) to the
// CustomAttributeBuilder constructor.
//
object[] ctorArgs = { "2.0.3033.0" };
CustomAttributeBuilder attribute =
new CustomAttributeBuilder(ctor, ctorArgs);
// Finally, apply the attribute to the assembly.
//
myAssembly.SetCustomAttribute(attribute);
// The pattern described above is used to create and apply
// several more attributes. As it happens, all these attributes
// have a constructor that takes a string, so the same ctorArgs
// variable works for all of them.
// The AssemblyTitleAttribute sets the Description field on
// the General tab and the Version tab of the Windows file
// properties dialog.
//
attributeType = typeof(AssemblyTitleAttribute);
ctor = attributeType.GetConstructor(ctorParameters);
ctorArgs = new object[] { "The Application Title" };
attribute = new CustomAttributeBuilder(ctor, ctorArgs);
myAssembly.SetCustomAttribute(attribute);
// The AssemblyCopyrightAttribute sets the Copyright field on
// the Version tab.
//
attributeType = typeof(AssemblyCopyrightAttribute);
ctor = attributeType.GetConstructor(ctorParameters);
ctorArgs = new object[] { "© My Example Company 1991-2005" };
attribute = new CustomAttributeBuilder(ctor, ctorArgs);
myAssembly.SetCustomAttribute(attribute);
// The AssemblyDescriptionAttribute sets the Comment item.
//
attributeType = typeof(AssemblyDescriptionAttribute);
ctor = attributeType.GetConstructor(ctorParameters);
attribute = new CustomAttributeBuilder(ctor,
new object[] { "This is a comment." });
myAssembly.SetCustomAttribute(attribute);
// The AssemblyCompanyAttribute sets the Company item.
//
attributeType = typeof(AssemblyCompanyAttribute);
ctor = attributeType.GetConstructor(ctorParameters);
attribute = new CustomAttributeBuilder(ctor,
new object[] { "My Example Company" });
myAssembly.SetCustomAttribute(attribute);
// The AssemblyProductAttribute sets the Product Name item.
//
attributeType = typeof(AssemblyProductAttribute);
ctor = attributeType.GetConstructor(ctorParameters);
attribute = new CustomAttributeBuilder(ctor,
new object[] { "My Product Name" });
myAssembly.SetCustomAttribute(attribute);
// Define the assembly's only module. For a single-file assembly,
// the module name is the assembly name.
//
ModuleBuilder myModule =
myAssembly.DefineDynamicModule(assemName.Name,
assemName.Name + ".exe");
// No types or methods are created for this example.
// Define the unmanaged version information resource, which
// contains the attribute informaion applied earlier, and save
// the assembly. Use the Windows Explorer to examine the properties
// of the .exe file.
//
myAssembly.DefineVersionInfoResource();
myAssembly.Save(assemName.Name + ".exe");
}
}
Imports System.Reflection
Imports System.Reflection.Emit
Module Example
Sub Main()
Dim assemName As New AssemblyName()
assemName.Name = "EmittedAssembly"
' Create a dynamic assembly in the current application ___domain,
' specifying that the assembly is to be saved.
'
Dim myAssembly As AssemblyBuilder = _
AppDomain.CurrentDomain.DefineDynamicAssembly(assemName, _
AssemblyBuilderAccess.Save)
' To apply an attribute to a dynamic assembly, first get the
' attribute type. The AssemblyFileVersionAttribute sets the
' File Version field on the Version tab of the Windows file
' properties dialog.
'
Dim attributeType As Type = GetType(AssemblyFileVersionAttribute)
' To identify the constructor, use an array of types representing
' the constructor's parameter types. This ctor takes a string.
'
Dim ctorParameters() As Type = { GetType(String) }
' Get the constructor for the attribute.
'
Dim ctor As ConstructorInfo = _
attributeType.GetConstructor(ctorParameters)
' Pass the constructor and an array of arguments (in this case,
' an array containing a single string) to the
' CustomAttributeBuilder constructor.
'
Dim ctorArgs() As Object = { "2.0.3033.0" }
Dim attribute As New CustomAttributeBuilder(ctor, ctorArgs)
' Finally, apply the attribute to the assembly.
'
myAssembly.SetCustomAttribute(attribute)
' The pattern described above is used to create and apply
' several more attributes. As it happens, all these attributes
' have a constructor that takes a string, so the same ctorArgs
' variable works for all of them.
' The AssemblyTitleAttribute sets the Description field on
' the General tab and the Version tab of the Windows file
' properties dialog.
'
attributeType = GetType(AssemblyTitleAttribute)
ctor = attributeType.GetConstructor(ctorParameters)
ctorArgs = New Object() { "The Application Title" }
attribute = New CustomAttributeBuilder(ctor, ctorArgs)
myAssembly.SetCustomAttribute(attribute)
' The AssemblyCopyrightAttribute sets the Copyright field on
' the Version tab.
'
attributeType = GetType(AssemblyCopyrightAttribute)
ctor = attributeType.GetConstructor(ctorParameters)
ctorArgs = New Object() { "© My Example Company 1991-2005" }
attribute = New CustomAttributeBuilder(ctor, ctorArgs)
myAssembly.SetCustomAttribute(attribute)
' The AssemblyDescriptionAttribute sets the Comment item.
'
attributeType = GetType(AssemblyDescriptionAttribute)
ctor = attributeType.GetConstructor(ctorParameters)
attribute = New CustomAttributeBuilder(ctor, _
New Object() { "This is a comment." })
myAssembly.SetCustomAttribute(attribute)
' The AssemblyCompanyAttribute sets the Company item.
'
attributeType = GetType(AssemblyCompanyAttribute)
ctor = attributeType.GetConstructor(ctorParameters)
attribute = New CustomAttributeBuilder(ctor, _
New Object() { "My Example Company" })
myAssembly.SetCustomAttribute(attribute)
' The AssemblyProductAttribute sets the Product Name item.
'
attributeType = GetType(AssemblyProductAttribute)
ctor = attributeType.GetConstructor(ctorParameters)
attribute = New CustomAttributeBuilder(ctor, _
New Object() { "My Product Name" })
myAssembly.SetCustomAttribute(attribute)
' Define the assembly's only module. For a single-file assembly,
' the module name is the assembly name.
'
Dim myModule As ModuleBuilder = _
myAssembly.DefineDynamicModule(assemName.Name, _
assemName.Name & ".exe")
' No types or methods are created for this example.
' Define the unmanaged version information resource, which
' contains the attribute informaion applied earlier, and save
' the assembly. Use the Windows Explorer to examine the properties
' of the .exe file.
'
myAssembly.DefineVersionInfoResource()
myAssembly.Save(assemName.Name & ".exe")
End Sub
End Module
설명
어셈블리 제목은 공백을 포함할 수 있는 친숙한 이름입니다.
Windows Vista에서 이 특성에 지정된 정보는 어셈블리에 대한 Windows 파일 속성 대화 상자의 세부 정보 탭에 표시됩니다. 속성 이름은 파일 설명입니다. Windows XP에서 이 정보는 Windows 파일 속성 대화 상자의 버전 탭에 나타납니다.
생성자
AssemblyTitleAttribute(String) |
AssemblyTitleAttribute 클래스의 새 인스턴스를 초기화합니다. |
속성
Title |
어셈블리 제목 정보를 가져옵니다. |
TypeId |
파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다. (다음에서 상속됨 Attribute) |
메서드
Equals(Object) |
이 인스턴스가 지정된 개체와 같은지를 나타내는 값을 반환합니다. (다음에서 상속됨 Attribute) |
GetHashCode() |
이 인스턴스의 해시 코드를 반환합니다. (다음에서 상속됨 Attribute) |
GetType() |
현재 인스턴스의 Type을 가져옵니다. (다음에서 상속됨 Object) |
IsDefaultAttribute() |
파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다. (다음에서 상속됨 Attribute) |
Match(Object) |
파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다. (다음에서 상속됨 Attribute) |
MemberwiseClone() |
현재 Object의 단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |
명시적 인터페이스 구현
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다. (다음에서 상속됨 Attribute) |
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다. (다음에서 상속됨 Attribute) |
_Attribute.GetTypeInfoCount(UInt32) |
개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1). (다음에서 상속됨 Attribute) |
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다. (다음에서 상속됨 Attribute) |