Ninject.MVC3 no longer on Nuget (or is it?)

It seems that within hours of posting my article on Dependency Injection: A Beginner’s Guide, some things had changed with the Ninject packages available on Nuget.

The article uses the package ‘Ninject.MVC3’ package, which also depends on Dave Ebbo’s WebActivator framework, allowing access to some really early initialisation for things such as dependency injection.

Today it seems as if the package includes Ninject 2.2 and has changed to ‘Ninject.Web.Mvc3’ (and I see they’ve also registered similar namespaces for MVC1 and MVC2), and this package no longer depends on WebActivator which means you don’t get the normal AppStart_NinjectMvc3.cs file in the root of your project. It also looks as though they’ve gotten rid of NinjectServiceLocator *and now instead we have *NinjectDependencyResolver.

However, WebActivator doesn’t seem strictly necessary. Taking these changes into account, I can just register all of my bindings in the Application_Start() method in global.asax.cs along with all my MVC routes and so on, and everything works as intended:

protected void Application_Start() { IKernel kernel = new StandardKernel(); kernel.Bind().To(); DependencyResolver.SetResolver(new Ninject.Web.Mvc.NinjectDependencyResolver(kernel)); AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); }


22nd Feb: And it looks as though everything is back to the way it was, with the Ninject.MCV3 package now available again. So pretty much everything in this post can be ignored but I’ll keep it up for historical archiving purposes!