I had my friend write this function up, and it's only working partly.
Public Shared Sub AttachAttributes(ByRef asmDef As AssemblyDefinition,
>> ByVal name As String, ByVal version As Version, ByVal title As String,
>> ByVal description As String, ByVal configuration As String, _
>
> ByVal company As String, ByVal product As String, ByVal copyright As
>> String, ByVal trademark As String, ByVal culture As String, ByVal Visible
>> As Boolean)
>
> Dim mRefTitle = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(AssemblyTitleAttribute).GetConstructor(New
>>
>> Type() {GetType(String)})))
>
> Dim mRefDesc = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(AssemblyDescriptionAttribute).GetConstructor(New
>>
>> Type() {GetType(String)})))
>
> Dim mRefConfig = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(AssemblyConfigurationAttribute).GetConstructor(New
>>
>> Type() {GetType(String)})))
>
> Dim mRefCompany = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(AssemblyCompanyAttribute).GetConstructor(New
>>
>> Type() {GetType(String)})))
>
> Dim mRefProduct = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(AssemblyProductAttribute).GetConstructor(New
>>
>> Type() {GetType(String)})))
>
> Dim mRefCopyright = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(AssemblyCopyrightAttribute).GetConstructor(New
>>
>> Type() {GetType(String)})))
>
> Dim mRefTrademark = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(AssemblyTrademarkAttribute).GetConstructor(New
>>
>> Type() {GetType(String)})))
>
> Dim mRefCulture = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(AssemblyCultureAttribute).GetConstructor(New
>>
>> Type() {GetType(String)})))
>
> Dim mRefVisible = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(ComVisibleAttribute).GetConstructor(New
>>
>> Type() {GetType(Boolean)})))
>
> Dim mRefGuid = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(GuidAttribute).GetConstructor(New
>>
>> Type() {GetType(String)})))
>
> Dim mRefVersion = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(AssemblyFileVersionAttribute).GetConstructor(New
>>
>> Type() {GetType(String)})))
>
> Dim mRefDebug = New
>> CustomAttribute(asmDef.MainModule.Import(GetType(DebuggableAttribute).GetConstructor(New
>>
>> Type() {GetType(DebuggableAttribute.DebuggingModes)})))
>
>
>> mRefTitle.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(AssemblyTitleAttribute)),
>>
>> If(title, "")))
>
> mRefDesc.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(AssemblyDescriptionAttribute)),
>>
>> If(description, "")))
>
> mRefConfig.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(AssemblyConfigurationAttribute)),
>>
>> If(configuration, "")))
>
> mRefCompany.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(AssemblyCompanyAttribute)),
>>
>> If(company, "")))
>
> mRefProduct.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(AssemblyProductAttribute)),
>>
>> If(product, "")))
>
> mRefCopyright.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(AssemblyCopyrightAttribute)),
>>
>> If(copyright, "")))
>
> mRefTrademark.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(AssemblyTrademarkAttribute)),
>>
>> If(trademark, "")))
>
> mRefCulture.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(AssemblyCultureAttribute)),
>>
>> If(culture, "")))
>
> mRefVisible.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(ComVisibleAttribute)),
>>
>> False))
>
> mRefGuid.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(GuidAttribute)),
>> Guid.NewGuid().ToString()))
>
> mRefVersion.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(AssemblyCultureAttribute)),
>>
>> If(version.ToString, "")))
>
> mRefDebug.ConstructorArguments.Add(New
>> CustomAttributeArgument(asmDef.MainModule.Import(GetType(DebuggableAttribute)),
>>
>> (DebuggableAttribute.DebuggingModes.DisableOptimizations Or
>> (DebuggableAttribute.DebuggingModes.EnableEditAndContinue Or
>> (DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints Or
>> DebuggableAttribute.DebuggingModes.Default)))))
>
>
>>
>>
>> asmDef.CustomAttributes.Add(mRefTitle)
>
> asmDef.CustomAttributes.Add(mRefDesc)
>
> asmDef.CustomAttributes.Add(mRefConfig)
>
> asmDef.CustomAttributes.Add(mRefCompany)
>
> asmDef.CustomAttributes.Add(mRefProduct)
>
> asmDef.CustomAttributes.Add(mRefCopyright)
>
> asmDef.CustomAttributes.Add(mRefTrademark)
>
> asmDef.CustomAttributes.Add(mRefCulture)
>
> asmDef.CustomAttributes.Add(mRefVisible)
>
> asmDef.CustomAttributes.Add(mRefGuid)
>
> asmDef.CustomAttributes.Add(mRefVersion)
>
> asmDef.CustomAttributes.Add(mRefDebug)
>
>
>>
>> asmDef.Name = New AssemblyNameDefinition(name, version)
>
> End Sub
>
>
It adds to the assembly fine, as I can see it in reflector, but windows
does not recognize it.
<http://localhostr.com/files/TGGYH94/capture.png>
<http://localhostr.com/files/wjRPpdu/capture.png>
--
--
mono-cecil