Asp.net mvc code not getting compiled on server

asp.net-mvc

i have this code in one of my asp.net mvc views:

   <%Html.RenderFile(@"C:\Members\newsletters\welcome.html");%>

I have created an extension on the Html class to read in a file. the code looks like this:

public static class HtmlRenderer
{
    public static void RenderFile(this HtmlHelper helper_, string path_)
    {
        var reader = new StreamReader(path_);
        var contents = reader.ReadToEnd();
        helper_.ViewContext.HttpContext.Response.Write(contents);
    }
}

This all works perfectly when i run in visual studio on my desktop but when i ftp these files to the server, i get the following error in the browser:

Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderFile' and no extension method 'RenderFile' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)

The HtmlRenderer class is in a namespace with my controllers so there is no other external assembly reference needed.

Does anyone have any idea how this could be happening or what i am doing wrong ?

Best Answer

You need to compile the project and then deploy (xcopy or publish from VS) to the server.