I want to use @Html
helpers in my view,but Visual Studio does not know that my project is MVC4. I have set Using System.Web.Mvc
Asked
Active
Viewed 274 times
-1
-
Duplicate of [Razor Intellisense Not Working VS2010 SP1Rel MVC3 from WPI Win7 x64](http://stackoverflow.com/questions/6133090/razor-intellisense-not-working-vs2010-sp1rel-mvc3-from-wpi-win7-x64), [IntelliSense won't work for MVC Razor cshtml page](http://stackoverflow.com/questions/8481477/intellisense-wont-work-for-mvc-razor-cshtml-page), [How to get IntelliSense for Razor View Engine](http://stackoverflow.com/questions/3491456/how-to-get-intellisense-for-razor-view-engine). Please use the search. At least please explain how you created the project and what exactly you have changed and tried. – CodeCaster Jan 07 '14 at 11:54
2 Answers
5
You are probably missing <add namespace="System.Web.Mvc" />
within your web.config
file under your Views folder
Please open web.config file Under Views folder and check if there the above tag is within namespaces
, if not add it and you should be able to use @Html
within your Razor views without manually referencing the library in every view

Amila
- 3,711
- 3
- 26
- 42
-
Yes I add there but it is red and unknown(my project has System.Web.Mvc) – Saeed Jan 07 '14 at 11:54
-
1Expand References in you project and see if there is any exclamation marks for System.Web.Mvc – Amila Jan 07 '14 at 11:56
-
-
yes,it is ok,Thank you Amila,after 4 min I can accept your response,Thank you again – Saeed Jan 07 '14 at 11:59
-
I guess you started an Empty Mvc project, if you are a fist timer you'll scratch your head for a long time to figure out what's missing. – Amila Jan 07 '14 at 12:05
0
Make sure that you are using Razor (.cshtml) instead of Asp.Net (.aspx) as the viewengine. You cant use @Html
in Asp.Net viewengine views, there you should use <% Html

Webking
- 1,822
- 2
- 20
- 28