7

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

2
  • 1
    I can't tell you how badly the VS 11 beta borked my regular VS/SQL installations. Commented May 16, 2012 at 23:19
  • 1
    +1 and lol @Tyr for "borked"... it must be election season! =p Commented Sep 26, 2012 at 7:01

3 Answers 3

19

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

Sign up to request clarification or add additional context in comments.

Comments

6

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>

Comments

0

Not sure why is it coming , however you can try adding reference to this dll System.Web.Mvc.dll explicitly to your project. The System.Web.Mvc.Html resides in this assembly only.

1 Comment

I'm not sure either. I ended up recreating a web api project and now it works. It might have been caused by web api not being officially supported by MonoDevelop/Mono yet.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.