views:

25

answers:

0

I am trying to use StructureMap to scan at runtime for assemblies that contain an implementation of the Registry class, but I'm running into a problem.

If a dll contains a Registry class, but also contains a reference to a dll that isn't present at runtime (say a Rhino.Mocks dll that isn't required at runtime), StructureMap will throw a StructureMapConfiguration exception resulting from an Assembly.GetExportedTypes() call.

Is there a way to avoid this behaviour in StructureMap?

ObjectFactory.Initialize(x =>
{
    x.Scan(s =>
    {
        s.AssembliesFromApplicationBaseDirectory();
        s.LookForRegistries();
    });
});

Thanks