ObjectFactory.Configure(scanner => scanner.Scan(x =>
{
x.AssembliesFromPath(settings.Directory);
x.AddAllTypesOf(typeof(IScannerConvention)).NameBy(n => n.Name);
}));
For some reason the types implementing IScannerConvention are not
registered. If we change AddAllTypesOf to typeof(object) we can see
that the types we are looking for are registered with the container
but that is obviously not what we want to do. We have also tried
moving the assemblies containing types implementing IScannerConvention
to the application base directory and use
x.AssembliesFromApplicationBaseDirectory(). This works and the
expected types are registered. But again, this is not a solution that
we can use as it will cause conflicts moving all assemblies to the
application base directory. At this point I really have no ide on what
could be wrong.
Any ideas are most welcome!
/ Kristoffer
/ Kristoffer
Just for reference, here my setup:
I tried with a solution with 3 projects:
Main - contains the scan code, references Dll1.
Dll1 - contains the interface
Dll2 - contains the implementation.
Built the solution, deleted dll1 in the bin/debug from dll2.
In Main I use an absolute path to bin/debug from Dll2.
With the trunk code, it will pick up the implementation, with 2.5.4
not.
Your setup is basically the same as mine. I downloaded the source from
the trunk and built it.
Tried running my app again but with the same result as before. The
types I'm looking for aren't registered when scanning with
x.AddAllTypesOf(typeof(IScannerConvention)).NameBy(n => n.Name) or
x.AddAllTypesOf<IScannerConvention>().NameBy(n => n.Name).
And as before, changing typeof(IScannerConvention) to typeof(object)
will find and register the implementations of IScannerConvention
(along with all other types in that assembly). Any other ideas?
/ Kristoffer
/ Kristoffer
It seems you were correct the first time around! The directory I was
scanning did not contain the assembly with the interface in it but
there was a second directory in play where it had sneaked itself into.
Thanks a lot for all your help Frank!!! I would be nowhere without
your help on this.
All the best / Kristoffer