agc93
agc93

Reputation: 683

Is there a replacement for MEF in .NET Core (or ASP.NET 5)

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.

Upvotes: 18

Views: 12362

Answers (1)

bricelam
bricelam

Reputation: 30375

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"
    }
  }
}

Upvotes: 9

Related Questions