Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Ninject.MVC3 to existing MVC(4) project

I am working on a project with MVC4, and have decided that I wish to add some dependency injection via Ninject. After download/install via NuGet, I find this error in the NinjectWebCommon.cs (Line 23):

The type 'System.Web.IHttpModule' is defined in an assembly 
that is not referenced. You must add a reference to assembly 
'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

and then a bit later (line 44):

The type or namespace name 'IHttpModule' could not be found 
(are you missing a using directive or an assembly reference?)

I expect that this Normally works, but that I've done something that doesn't work when adding Ninject to the project after the fact.

Edit: The above errors are only thrown by the test project....

like image 513
reidLinden Avatar asked May 29 '12 13:05

reidLinden


1 Answers

Make sure you specify the System.Web reference in both the main and test project. The test projects have their own list of references to maintain. I expect you don't have System.Web in the test project.

like image 79
Leroy Avatar answered Nov 16 '22 01:11

Leroy