Quantcast
Channel: Managed Extensibility Framework
Viewing all articles
Browse latest Browse all 265

New Post: MEF Container Initialization

$
0
0
I have a problem initializing MEF. I built an application that uses MEF and it seems to work fine on a WIndows 8 and Windows 7 SP1 machines. However, when I run the application on a third machine (windows 7 SP1) I get a ImportCardinalityMismatchException during the container.Compose method. I don't know why the application runs fine on two machines and on another it does not. Any suggestions? Here is my initialization:
        private void ComposeMef()
        {
            var catalog = new AggregateCatalog(
                    new DirectoryCatalog("."),
                    new AssemblyCatalog(Assembly.GetExecutingAssembly()));

            var batch = new CompositionBatch();
            batch.AddPart(this);

            _container = new CompositionContainer(catalog);
            _container.Compose(batch);
        }

Viewing all articles
Browse latest Browse all 265

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>