My scenerio is as follows, I have different assemblies that contain UI components and loading the assemblies to examine the types triggers a lot of dependent assemblies to load.
The approach I tried before looking at MEF was to decorate any assembly that contains UI exports with an assembly level attribute. I would then examine all loaded assemblies and perform appropriate cached cataloging.
I say cached catalogin because this done in a designer context (e.g. Blend or VS2010) so it is a bit time sensitive and the loading just makes it worse. It may also be retriggered when another build occurs.
For loaded assemblies it is not an issue, however, the end-user's project may contain extra assemblies in the project output directory that are not loaded (due to no direct references), but do contain UI parts.
The solution I tried was to enumerate all assemblies in the output directory, however, using Assembly.Load or Assembly.ReflectionLoad both result in undesirable side-effects. ReflectionLoad still fails to retrieve assembly level attributes (because
more dependant attributes must be loaded).
I was just about to try mono.cecil, but my follow-on question is how hard would it be to use the cached catalogs and is post referenced above a sample of that?