Deprecating obsolete NuGet packages

Jun 29, 2012 at 7:16 PM

Hi everyone,

In November last year we published an experimental NuGet package integrating MEF with ASP.NET MVC. This got the ball rolling on a much smoother experience using MEF in web apps, and led us to design and release the fully-supported Microsoft.Composition package tailored specifically for building high-throughput web applications in addition to Windows 8 Metro style apps.

We have now marked the earlier experimental Microsoft.Mef.Lightweight and Microsoft.Mef.MvcCompositionProvider packages as “deprecated” to indicate that we will not be updating them as-is. These packages will no longer be listed in NuGet.org search results but remain in the repository so that package restore and dependent packages will still function correctly.

Microsoft.Mef.Lightweight is superseded by Microsoft.Composition and users should migrate to that package.

Microsoft.Mef.MvcCompositionProvider does not have a direct replacement at this point – we have migrated the source over to use the new Microsoft.Composition package and published it on theCodePlex site for anyone who wishes to migrate forward. We are actively working on making a simple ASP.NET MVC integration for Microsoft.Composition available on NuGet, but will not be releasing this on the same timeline as the core package.

Please let us know if you have any questions or concerns!

Thanks, the MEF Team.

Jul 1, 2012 at 1:49 AM

Is there a date that this may hit?

I'm only asking because I am just using MEF for the first time, but I'm in a MVC4 app and it seems I can't Inject a generic repository into my controller unless I have this :) luckily I discovered this tonight, and I saw this post.  Thanks for the update!

Jul 2, 2012 at 4:58 PM

Hi Phil,

Your best bet is to install Microsoft.Composition directly, and add your own implementation of IDependencyResolver. There's only a small amount of code required to get basic dependency injection into controllers up and running today.

The sample at http://mef.codeplex.com/SourceControl/changeset/view/fa1ea50c2b69#oob%2fdemo%2fMicrosoft.Composition.Demos.Web.Mvc%2fCompositionScopeDependencyResolver.cs is a good place to start.

Hope this helps,

Nick

Jul 30, 2012 at 5:21 PM
Edited Dec 3, 2012 at 5:06 PM

(I am philcarbone - different ID)

I made a small assembly/project with everything I needed (copied). Then I included it in my MVC4 app. [removed zip file... the file sharing service started serving the wrong files!] I will upload again once I get the file again.

Jul 30, 2012 at 7:34 PM

Did you have to wire it into Application_Start somehow or was it just enough to have the assembly referenced in the project?

Sorry, very new to MEF and IoC in general.

Jul 30, 2012 at 7:47 PM
Edited Jul 30, 2012 at 7:47 PM

If you look in the Properties/AssemblyInfo.cs file. You will see the magic. 
[assembly: PreApplicationStartMethod(typeof(RequestCompositionScopeModule), "Register")]

In other words, you don't have to do anything. Just include it in the solution.

Jul 30, 2012 at 9:11 PM

Awesome!  That did it.  I had almost the same code in the project as you did, I was just missing the assembly: reference.

Thanks so much.

Wed at 1:04 PM