You can reach points 1. and 3. by placing directories in different export providers, and then passing the export providers to the CompositionContainer constructor in priority order as follows:
var dirCatalog = new DirectoryCatalog(...); var provider1 = new CatalogExportProvider(dirCatalog); var assemblyCatalog = new AssemblyCatalog(...); var provider2 = new CatalogExportProvider(assemblyCatalog); var container = new CompositionContainer(provider1, provider2);
Now you can use container , as usual, and first they will look for parts in the catalog directory, and the second - the catalog. You will not receive power exceptions if they are present in both.
To reach point 2., you must mark individual imports so that the default value (for example, null ) is [Import(typeof(SomeType),AllowDefault=true] .
source share