Ninject.MVC5 not generating NinjectWebCommon.Cs

Jaber Kibria picture Jaber Kibria · Nov 17, 2017 · Viewed 16.5k times · Source

I'm developing a MVC5 project on Visual Studio 2017 Version 15.4. I'm getting unexpected result here what I never faced before. I've installed Ninject.MVC5 package from nuget. It's installing nicely and not giving any error or warning. But problem is it's not generating NinjectWebCommon.cs file in App_Start folder. Is there any reason?

Answer

Joe picture Joe · Nov 21, 2017

It looks like the most recent Ninject.Web.Common.WebHost 3.3.0 NuGet package no longer includes the NinjectWebCommon.cs. Older versions, such as 3.2.0 do include this file.

Ninject.Web.Common.WebHost 3.3.0 provides a NinjectHttpApplication class you can derive from and use instead of the NinjectWebCommon.cs. The wiki documentation for Ninject does not seem to have been updated but it looks like using the NinjectHttpApplication is one documented approach

see mat's comment - Web API2 NinjectWebCommon.cs do not appear