The AssemblyCopyrightAttribute sets the Copyright field on the Version tab. : Reflection « Development « VB.Net






The AssemblyCopyrightAttribute sets the Copyright field on the Version tab.

  

Imports System
Imports System.Reflection
Imports System.Reflection.Emit

Module Example
   Sub Main()
      Dim assemName As New AssemblyName()
      assemName.Name = "EmittedAssembly"

      Dim myAssembly As AssemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemName,AssemblyBuilderAccess.Save)

      Dim attributeType As Type = GetType(AssemblyFileVersionAttribute)

      Dim ctorParameters() As Type = { GetType(String) }

      Dim ctor As ConstructorInfo = attributeType.GetConstructor(ctorParameters)

      Dim ctorArgs() As Object = { "2.0.3033.0" }
      Dim attribute As New CustomAttributeBuilder(ctor, ctorArgs)

      myAssembly.SetCustomAttribute(attribute)


      attributeType = GetType(AssemblyCopyrightAttribute)
      ctor = attributeType.GetConstructor(ctorParameters)
      ctorArgs = New Object() { " My Example Company 1991-2005" }
      attribute = New CustomAttributeBuilder(ctor, ctorArgs)
      myAssembly.SetCustomAttribute(attribute)

      myAssembly.DefineVersionInfoResource()
      myAssembly.Save(assemName.Name & ".exe")

   End Sub 
End Module

   
    
  








Related examples in the same category

1.Reflection Information for Integer ClassReflection Information for Integer Class
2.Fill Reflection Data into ListViewFill Reflection Data into ListView
3.Use Reflection to create Class instance and call methodUse Reflection to create Class instance and call method
4.Define Attributes and Use Reflection to get its valueDefine Attributes and Use Reflection to get its value
5.Get Method information and invoke Method using Reflection APIGet Method information and invoke Method using Reflection API
6.Get Method InformationGet Method Information
7.Get Class Member and Property Information from base and inherited ClassGet Class Member and Property Information from base and inherited Class
8.Reflection: display the member of Form ClassReflection: display the member of Form Class
9.Reflector Utilities
10.The AssemblyDescriptionAttribute sets the Comment item.
11.The AssemblyCompanyAttribute sets the Company item
12.The AssemblyProductAttribute sets the Product Name item
13.Define the assembly's only module. For a single-file assembly, the module name is the assembly name.
14.The AssemblyTitleAttribute sets the Description field on the General tab and the Version tab of the Windows file properties dialog.