Hey, On Wed, May 19, 2010 at 11:20 AM, Jan <[email protected]> wrote: > I am adding new classes and methods to the assembly. At one place I am > emitting a call to Object.MemberWiseClone(). To get the method I am > calling: > > var method = > moduleDefinition.Import(moduleDefinition.ResolveMethod(typeof(object), > "MemberwiseClone", null)); > > The result is an Object.MemberWiseClone() from mscorlib 4.0 and not > mscorlib 2.0. If I look at the references of the generated assembly I > have an additional reference to mscorlib 4.0.
Which is pretty much expected, typeof (object).Module is the 4.0 mscorlib. > How can i avoid this? You can either patch the AssemblyNameReference for this special case, or you can Import the method from the 2.0 mscorlib loaded with Cecil. -- Jb Evain <[email protected]> -- -- mono-cecil
