[导入]删除 Strong Name & SuppressIldasmAttribute
做这个没有什么比 Mono.Cecil 更方便的了。代码过于简单,不做详述。
文章来源:http://www.rainsts.net/article.asp?id=682
var assembly = AssemblyFactory.GetAssembly(test.dll");
foreach (CustomAttribute attribute in assembly.CustomAttributes)
{
if (attribute.Constructor.DeclaringType.Name == "SuppressIldasmAttribute")
{
assembly.CustomAttributes.Remove(attribute);
break;
}
}
assembly.Name.PublicKey = null;
assembly.Name.PublicKeyToken = null;
AssemblyFactory.SaveAssembly(assembly, "test.dll");
foreach (CustomAttribute attribute in assembly.CustomAttributes)
{
if (attribute.Constructor.DeclaringType.Name == "SuppressIldasmAttribute")
{
assembly.CustomAttributes.Remove(attribute);
break;
}
}
assembly.Name.PublicKey = null;
assembly.Name.PublicKeyToken = null;
AssemblyFactory.SaveAssembly(assembly, "test.dll");
文章来源:http://www.rainsts.net/article.asp?id=682

浙公网安备 33010602011771号