16

We know that .NET Core (the open-source components) are only a subset of the full .NET Framework, and that ASP.NET 5 (and MVC 6) is built on .NET Core. Does this mean that Managed Extensibility Framework (MEF) is not available in ASP.NET 5?

If so, is there any replacement for dynamic extensibility available in .NET Core?

I have a number of applications that use MEF to dynamically load plugins and external integrations and it would be a pity if they were locked into the .NET Framework just because they use MEF.

agc93
  • 663
  • 1
  • 7
  • 19
  • 2
    MEF is definitely supported in the .Net 4.6 Preview. – Claies Mar 02 '15 at 01:23
  • 1
    you can also probably use http://www.nuget.org/packages/microsoft.composition – Claies Mar 02 '15 at 01:26
  • @Claies I noticed that, but 4.6 is only the full framework, no Core. MEF isn't appearing in the corefx repo, so I'm not sure it's included. Also, that NuGet package lists as only supported on .NET Framework, but if it works in a PCL, I might be able to reference that from a vNext/5 project.. – agc93 Mar 02 '15 at 01:30

1 Answers1

7

The existing NuGet package should work. It's portable, and .NET Core is a backward-compatible evolution of the portable API surface. ASP.NET Core won't automatically install it, however because the package doesn't explicitly say that it's compatible with .NET Core.

To install the package, you'll need to add an imports section to your project.json:

{
  "dependencies": {
    "Microsoft.Composition": "1.0.30"
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": "portable-net45+win8"
    }
  }
}
bricelam
  • 28,825
  • 9
  • 92
  • 117