<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/asp-net-mvc-and-the-managed-extensibility-framewok-on-nuget-xpermblzg" -->

---
title: ASP.NET MVC and the Managed Extensibility Framewok on NuGet
description: A walkthrough shows how to integrate the Managed Extensibility Framework (MEF) with ASP.NET MVC 3 using the new MefContrib.MVC3 NuGet package. Installing the...
canonical: https://daily.dev/posts/asp-net-mvc-and-the-managed-extensibility-framewok-on-nuget-xpermblzg
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: ASP.NET MVC and the Managed Extensibility Framewok on NuGet | daily.dev
og:description: A walkthrough shows how to integrate the Managed Extensibility Framework (MEF) with ASP.NET MVC 3 using the new MefContrib.MVC3 NuGet package. Installing the...
og:url: https://daily.dev/posts/asp-net-mvc-and-the-managed-extensibility-framewok-on-nuget-xpermblzg
og:image: https://api.daily.dev/og/posts/XperMbLzG.png
og:image:alt: ASP.NET MVC and the Managed Extensibility Framewok on NuGet
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# ASP.NET MVC and the Managed Extensibility Framewok on NuGet

**[Maarten Balliauw](https://daily.dev/sources/maartenballiauw)** · 4 min read · 0 upvotes · 0 comments

## Summary

A walkthrough shows how to integrate the Managed Extensibility Framework (MEF) with ASP.NET MVC 3 using the new MefContrib.MVC3 NuGet package. Installing the package via Install-Package MefContrib.MVC3 adds an AppStart file that wires MEF into MVC, and the MefContrib.Web.Mvc assembly uses a ConventionCatalog to auto-export controllers so developers no longer need to manually decorate controllers with [Export] attributes. The post demonstrates refactoring the AccountController to use [Import] properties or an ImportingConstructor to resolve FormsAuthenticationService and MembershipService dependencies automatically, and notes MefContrib itself is now also distributed via NuGet with features like AOP-style interception.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.maartenballiauw.be/posts/2011-02-01-aspnet-mvc-and-the-managed-extensibility-framewok-on-nuget>

## Questions this post answers

### How do I use MEF for dependency injection in an ASP.NET MVC 3 controller?

Install the MefContrib.MVC3 NuGet package, which adds an AppStart_MefContribMVC3.cs file wiring MEF into the MVC pipeline. MefContrib.Web.Mvc's ConventionCatalog automatically exports every controller, so you only need to add [Export] attributes to your services and either [Import] properties or an [ImportingConstructor] on the controller to resolve dependencies like IFormsAuthenticationService and IMembershipService.

_Developers wiring dependency injection into legacy MVC apps can find similar practical integration notes on daily.dev._

### Do I still need to manually export every MVC controller when using MEF with MefContrib?

No, MefContrib.Web.Mvc uses the ConventionCatalog from MefContrib to automatically export every controller it finds, removing the need to manually decorate each controller class with an [Export] attribute, which was a common source of developer mistakes in earlier manual MEF and MVC setups.

_daily.dev surfaces practical fixes like this for developers maintaining older dependency-injection setups._

## Similar posts on daily.dev

- [How to Upgrade ASP.NET MVC to .NET Step by Step](https://daily.dev/posts/how-to-upgrade-asp-net-mvc-to-net-step-by-step-i3p1uesfs) · C\# Corner · 2 upvotes · 0 comments
- [How to Migrate from ASP.NET Framework to ASP.NET Core](https://daily.dev/posts/how-to-migrate-from-asp-net-framework-to-asp-net-core-e22ntd3va) · freeCodeCamp · 4 upvotes · 0 comments
- [The .NET Tools Blog](https://daily.dev/posts/the-net-tools-blog-tdsv0g0uj) · JetBrains · 6 upvotes · 0 comments

---

Tags: [#c#](https://daily.dev/tags/c#), [#dependency-injection](https://daily.dev/tags/dependency-injection), [#nuget](https://daily.dev/tags/nuget)

[View this post on daily.dev](https://daily.dev/posts/asp-net-mvc-and-the-managed-extensibility-framewok-on-nuget-xpermblzg)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"ASP.NET MVC and the Managed Extensibility Framewok on NuGet","url":"https://daily.dev/posts/asp-net-mvc-and-the-managed-extensibility-framewok-on-nuget-xpermblzg","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/asp-net-mvc-and-the-managed-extensibility-framewok-on-nuget-xpermblzg"},"datePublished":"2026-10-04T13:04:30.235Z","dateModified":"2026-10-04T13:07:58.272Z","description":"A walkthrough shows how to integrate the Managed Extensibility Framework (MEF) with ASP.NET MVC 3 using the new MefContrib.MVC3 NuGet package. Installing the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b9b138ace2db868488ddcbbab228d248?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b9b138ace2db868488ddcbbab228d248?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Maarten Balliauw","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Maarten Balliauw","logo":"https://media.daily.dev/image/upload/s--rOTg3VYO--/f_auto,q_auto/v1791119043/logos/maartenballiauw?_a=BAMAMicg0","url":"https://daily.dev/sources/maartenballiauw"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/asp-net-mvc-and-the-managed-extensibility-framewok-on-nuget-xpermblzg","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"c#,dependency-injection,nuget","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Maarten Balliauw","item":"https://daily.dev/sources/maartenballiauw"},{"@type":"ListItem","position":3,"name":"ASP.NET MVC and the Managed Extensibility Framewok on NuGet"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/asp-net-mvc-and-the-managed-extensibility-framewok-on-nuget-xpermblzg#faq","mainEntity":[{"@type":"Question","name":"How do I use MEF for dependency injection in an ASP.NET MVC 3 controller?","acceptedAnswer":{"@type":"Answer","text":"Install the MefContrib.MVC3 NuGet package, which adds an AppStart_MefContribMVC3.cs file wiring MEF into the MVC pipeline. MefContrib.Web.Mvc's ConventionCatalog automatically exports every controller, so you only need to add [Export] attributes to your services and either [Import] properties or an [ImportingConstructor] on the controller to resolve dependencies like IFormsAuthenticationService and IMembershipService. Developers wiring dependency injection into legacy MVC apps can find similar practical integration notes on daily.dev."}},{"@type":"Question","name":"Do I still need to manually export every MVC controller when using MEF with MefContrib?","acceptedAnswer":{"@type":"Answer","text":"No, MefContrib.Web.Mvc uses the ConventionCatalog from MefContrib to automatically export every controller it finds, removing the need to manually decorate each controller class with an [Export] attribute, which was a common source of developer mistakes in earlier manual MEF and MVC setups. daily.dev surfaces practical fixes like this for developers maintaining older dependency-injection setups."}}]}
```

