AssemblyDefinition a = AssemblyDefinition.ReadAssembly(fileName);
foreach (CustomAttribute attribute in a.CustomAttributes)
{
if (attribute.AttributeType.Name ==
"AssemblyFileVersionAttribute")
{
attribute.ConstructorArguments[0] =
new
CustomAttributeArgument(a.MainModule.TypeSystem.String, fileversion);
}
if (attribute.AttributeType.Name ==
"AssemblyTitleAttribute")
{
attribute.ConstructorArguments[0] =
new
CustomAttributeArgument(a.MainModule.TypeSystem.String, fileDsc);
}
if (attribute.AttributeType.Name ==
"AssemblyDescriptionAttribute")
{
attribute.ConstructorArguments[0] =
new
CustomAttributeArgument(a.MainModule.TypeSystem.String, comments);
}
if (attribute.AttributeType.Name ==
"AssemblyCompanyAttribute")
{
attribute.ConstructorArguments[0] =
new
CustomAttributeArgument(a.MainModule.TypeSystem.String, compname);
}
if (attribute.AttributeType.Name ==
"AssemblyProductAttribute")
{
attribute.ConstructorArguments[0] =
new
CustomAttributeArgument(a.MainModule.TypeSystem.String, prodname);
}
if (attribute.AttributeType.Name ==
"AssemblyProductAttribute")
{
attribute.ConstructorArguments[0] =
new
CustomAttributeArgument(a.MainModule.TypeSystem.String, prodname);
}
if (attribute.AttributeType.Name ==
"AssemblyCopyrightAttribute")
{
attribute.ConstructorArguments[0] =
new
CustomAttributeArgument(a.MainModule.TypeSystem.String, copyright);
}
if (attribute.AttributeType.Name ==
"InternalNameAttribute")
{
attribute.ConstructorArguments[0] =
new
CustomAttributeArgument(a.MainModule.TypeSystem.String, a.Name);
}
}
On Thursday, August 3, 2017 at 7:06:43 AM UTC+3, [email protected] wrote:
>
> Hi,
>
> I've used cecil to change a compiled assembly name (had to change both
> Name & MainModule.Name). after saving the PE to disk I was hoping the
> OriginalFileName property will get changed as well.
> It is part of the Version Info resource, which can't be accessed using
> Mono.cecil.
>
> These attributes don't appear in the CustomAttributes collection as well.
>
> Thank you!
>
--
--
--
mono-cecil
---
You received this message because you are subscribed to the Google Groups
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.