Search code examples
c#mefasp.net-corednx

When targeting dnx451 I don't seem to be able to add reference to MEF (System.ComponentModel.Composition)


Using the latest beta (beta8) and only targeting dnx451 I thought that I would be able to make use of the full .net client framework. I am trying to create a plugin infrastructure in a vnext/dnx application where I can reload the plugins without restarting the app using MEF and have seen some examples but it doesn't look like I can use MEF with dnx451 (I am not targeting dnxcore).


Solution

  • So just in case anyone else runs across this the main Issue that I ran into was the Visual Studio tooling was not updating the project.json correctly. Below is an example of how the framework assemblies references should be added (Such as MEF)

    {
      "version": "1.0.0-*",
      "description": "AutoSpark.Runner Class Library",
      "authors": [ "bferr" ],
      "tags": [ "" ],
      "projectUrl": "",
      "licenseUrl": "",
        "frameworks": {
            "net451": {
                "frameworkAssemblies": {
                    "System.ComponentModel.Composition": "4.0.0.0",
                    "System.Reflection.Context": "4.0.0.0",
                    "System.ComponentModel.Composition.Registration": "4.0.0.0"
                }
            }
        }
    }