Hi I'm trying to figure out if I can achieve a unique Assembly Weaver for all the potential frameworks I have to play with.
My current project injects code in a given Xna game assembly that will wrap method calls so that it catches some profiling figures so they get presented to the developer while he plays the game. (You can see it running with PostSharp on my website http://indiefreaks.com). But the PostSharp option wasn't supported on the Xbox 360 and I therefore am implementing all the weaving stuff using Cecil and so far, so good. I already have it working on Windows. The process is simple: I have an AOP.dll assembly that is compiled against the 3 available Xna frameworks to be sure that it uses the right .Net framework (Windows = .Net 4; Xbox 360 = Specialized Compact Framework; WP7 = Compact Framework 2.0.5) This AOP assembly contains the runtime code that will get called by the injected code. I have a Xna.Profiler.dll assembly that reads the figures stored by the classes defined in the AOP assembly. This Xna.Profiler.dll class is also compiled for each of the 3 Xna frameworks. I now have an AssemblyWeaver application that is built using a .Net 4 Windows Console and processes the assembly provided as an argument to inject the code where it needs to be. The AssemblyWeaver application targeting the .Net 4 runtime, it won't work on the Xbox and WP7 assemblies. I would need a way to load the Xbox and WP7 referenced assemblies without specifying them in the AssemblyWeaver application (like for instance, by passing a platform argument) so that instead of using the .Net 4 types directly, it would import them from these other ones. My 1st question would then be: Is it possible to have one single program that would late bind assemblies so they get used for code injection? And secondly: If it is possible, I imagine that I would need to import these types, methods, fields differently than using the usual Model.Import(typeof(whatever)); What would be that second option? Thanks -- -- mono-cecil
