I\'ve created a new MVC Web application and I have references to Ninject.dll, Ninject.Web.Common.dll and Ninject.Web.MVC.dll.
Global.asax.cs:
To be explicitly clear about this, if you use NuGet to add the 'Ninject.Mvc3' package (I used version 3.0.0.6), there is no need to make any modifications to global.asax.cs
. The NuGet package does the magic for you by creating the NinjectWebCommon
class in the App_Start
folder of your MVC 4 project.
I say this because I seem to have followed a similar tutorial to the original poster (I followed an article on The Code Project called 'Dependency Injection in asp.net mvc4 and webapi using Ninject'), and had exactly the same issue as the original poster. The Code Project article doesn't make it clear that you should either use NuGet (and don't touch global.asax.cs
or add the Ninject references manually (and amend global.asax.cs
).