Hi JB, Thanks for the quick reply!
You are absolutely right, this is the exact problem i'm having. I changed all primitive references to come from Module.TypeSystem and i'm still working on replacing the usage of module.Import(typeof(XXX)); // and module.Import(System.Reflection.MethodBase(XX)); in my code. The situation makes sense now, because of your help. Have a good day, Bert Op vrijdag 24 februari 2017 00:13:04 UTC+1 schreef Jb Evain: > > Hi Bert, > > It's a matter of the type system that you use to create references. > > If you use ImportReference on a System.Type/System.Reflection.MethodInfo > for instance, Cecil will have to use the one that is of the project doing > the patching. Which is what I suspect you're doing. > > You need to use the Cecil type system and ImportReference from > TypeDefinition/MethodDefinition defined in other assemblies. > For primitive types, you can use Module.TypeSystem. > > Jb > > On Thu, Feb 23, 2017 at 3:08 PM, Bert Proesmans <[email protected] > <javascript:>> wrote: > >> Hey, >> >> I use this framework to dynamically update code of existing dll files. >> When i inspect the generated file, it has more dependencies than the >> original file eg: the mscorlib of the targeted '.Net framework' of the >> project doing the patching. >> I looked into the source code to prevent Cecil from generating this >> dependency, but i can't get my head around it. >> >> Is there a way to prevent Cecil from adding unnecessary (are they >> eventually unnecessary?) dependencies when generating updated dll files? >> >> Intuitively i think updating the target '.Net framework' of the project >> doing the patching will also work, but that would mean i have to re-target >> for every different >> dll version i want to patch. >> >> Maybe i'm missing something? >> >> I'm looking forward to your help and thanks in advance, >> Bert. >> >> -- >> -- >> -- >> mono-cecil >> --- >> You received this message because you are subscribed to the Google Groups >> "mono-cecil" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- -- -- mono-cecil --- You received this message because you are subscribed to the Google Groups "mono-cecil" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
