How to solve DynamicUtility errors in my Ninject.web.commons.cs file when using ninject and MVC5?

426 views Asked by At

I am doing MVC Web API application in Visual Studio 2017 and I am getting errors within my Ninject.Web.Common file

I installed via Nuget,

Ninject,
Ninject.Web.Common,
Ninject.MVC5,
Ninject.Web.Common.WebHost,
Ninject.Web.WebApi,
Ninject.web.WebApi.WebHost

The errors that I am getting

The name 'DynamicModuleUtility' does not exist in the current context   (are you missing a using directive or an assembly reference?)Ninject.Web.Common.cs
\App_Start\Ninject.Web.Common.cs    24  

The type or namespace name 'OnePerRequestHttpModule' could not be found (are you missing a using directive or an assembly reference?)Ninject.Web.Common.cs  23

This is all very confusing because some articles are saying that the latest version of ninject should not even contain a web Ninject.web.common.cs file? I am missing a package or did I download too many packages for ninject.

1

There are 1 answers

1
Zidane On

I solved this by adding using Microsoft.Web.Infrastructure.dll as reference and also by putting using Microsoft.Web.Infrastructure.DynamicModuleHelperat the top of the commons class