Greeting Mono.Cecil users and developers!

I'm trying to use Mono.Cecil (0.9.5.0) to rename namespaces from an
already compiled assembly. I then sign the assembly with ILMerge. What
I've written appears to work, but gives me a cryptic peverify error
after signing it:

Microsoft (R) .NET Framework PE Verifier.  Version  4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

[MD]: Error: TypeRef has no name. [token:0x010000BB]

This output is from peverify for VS2010, but the same happens for
peverify for VS2008. I looked at this symbol in ildasm, and it is
indeed a symbol with an empty TypeRef name. peverify /il gives no
errors.

Here is a code fragment:

                // Rebrand the namespace.
                var assembly =
Mono.Cecil.AssemblyDefinition.ReadAssembly(targetAssemblyTempFile);
                foreach (Mono.Cecil.TypeDefinition type in
assembly.MainModule.Types)
                {
                    type.Namespace =
type.Namespace.Replace(m_sourceBrand, m_brand);
                }
                assembly.Write(targetAssemblyTempFile);

Now if comment out the changing of the Namespace property, there are
no peverify errors. So I don't think the problem is ILMerge. Has
anyone tried renaming namespaces? Is this the correct way to iterate
through all types in an assembly?

Thanks in advance,
James

-- 
--
mono-cecil

Reply via email to