I’m having an issue with my ASP.Net MVC application, I’m using MVC 3 with Razor, and I cannot use the Raw extension method.
This is the error I get:
CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Raw' and no extension method 'Raw' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found.
I verified and the MVC dll version is 3.0, the target framework for the project is 4, I just have no idea of what is going on.
I even tried creating a new MVC 3 project from scratch but it doesn’t work either.
EDIT:
This is the code I’m using for my Index.cshtml view on the test project (just a new ASP.NET MVC 3 project):
@{
View.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Index</h2>
@Html.Raw("<span>test</span>")
The error is exactly the same described above.
Any ideas? thanks
Finally fixed the issue.
I just went to http://www.asp.net/mvc and downloaded the standalone installer of MVC3, apparently there was something wrong with the version I was using (I installed it using WPI).
Now everything works as expected (including the ViewBag that wasn’t working).