Using MEF in a VSTO project and a specific container as follows
var catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog(this.GetType().Assembly)); catalog.Catalogs.Add(...); container = new CompositionContainer(catalog); container.SatisfyImportsOnce(this);
everything works well, using different libraries, except when used in code
ServiceLocator.Current.GetInstance<MyInterface>()
which, of course, throws a NullReferenceException
Given that the ServiceLocator is in its own DLL, I wonder how to connect it or even possible?
source share