Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC application crashes due to System.Web.Mvc not containing the html namespace [duplicate]

Possible Duplicate:
The type or namespace name does not exist in the namespace ‘System.Web.Mvc’

When I compile my MVC4 project locally I receive the following error:

CS0234: The type or namespace name 'Html' does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)

Line 25:         <add namespace="System.Web.Mvc" />
Line 26:         <add namespace="System.Web.Mvc.Ajax" />
Line 27:         <add namespace="System.Web.Mvc.Html" />    <--- this line
Line 28:         <add namespace="System.Web.Routing" />
Line 29:         <add namespace="System.Web.WebPages" />

What could be causing this? If I push the code to AppHarbor it builds and runs correctly

like image 325
tamaslnagy Avatar asked May 16 '12 23:05

tamaslnagy


Video Answer


2 Answers

You also need to set the DLL reference as copy local.

like image 64
TheWim Avatar answered Nov 15 '22 16:11

TheWim


Try adding System.Web.Mvc namespace to the list of assemblies in the compilation section

<compilation debug="true">
    <assemblies>
       <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </assemblies>
</compilation>
like image 28
Rami Sarieddine Avatar answered Nov 15 '22 15:11

Rami Sarieddine