I'm trying to change the names of all the types in a loded assembly. i
was able to do that but when i'm trying to change their basetype and
interfaces names i get this exception:

Unhandled Exception: System.NotSupportedException: Specified method is
not supported.
   at Mono.Cecil.TypeSpecification.set_Namespace(String value) in C:
\Documents and Settings\ל\Desktop\SVN\class\Mono.Cecil\Mono.Cecil
\TypeSpecification.cs:line 44

when looking at Cecil source code i see that TypeSpecification fields
can't be set so how can i do that?

this is my code (the function runs for each type in the assembly):

if (!type.Namespace.StartsWith("CSS")) {
                    type.Namespace = "CSS." + type.Namespace;
}

if (!type.BaseType.Namespace.StartsWith("CSS"))
{
                    type.BaseType.Namespace = "CSS." +
type.BaseType.Namespace;
}

foreach (TypeReference  inter in type.Interfaces) {
                    if (!inter.Namespace.StartsWith("CSS"))
                    {
                        inter.Namespace = "CSS." + inter.Namespace;
                    }
}


--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to