[导入]删除 Strong Name & SuppressIldasmAttribute

做这个没有什么比 Mono.Cecil 更方便的了。代码过于简单,不做详述。
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");

文章来源:http://www.rainsts.net/article.asp?id=682
posted @ 2008-03-21 22:36  橡树木棉狗  阅读(234)  评论(0编辑  收藏  举报