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(AssemblyDescriptionAttribute)
ctor = attributeType.GetConstructor(ctorParameters)
attribute = New CustomAttributeBuilder(ctor, _
New Object() { "This is a comment." })
myAssembly.SetCustomAttribute(attribute)
myAssembly.DefineVersionInfoResource()
myAssembly.Save(assemName.Name & ".exe")
End Sub
End Module