asp.net-mvc-3razorhelperapp-code

Can I have a global razor @helper outside of App_Code?


The question is simple as stated in the title: Is there a way of having razor helpers outside of 'App_Code'?

Example ( HtmlEx.cshtml file ):

@helper Script(string fileName, UrlHelper url)
{
<script src="@url.Content("~/Scripts/" + fileName)" type="text/javascript"></script> 
}

I ask this because I don't really have anything else to put in App_Code; I want to structure my project a bit different.

Thanks.

UPDATE: I don't want any other type of extensions. I am interested in only pure razor helpers as Scott is speaking about here: http://weblogs.asp.net/scottgu/archive/2011/05/12/asp-net-mvc-3-and-the-helper-syntax-within-razor.aspx


Solution

  • The question is simple as stated in the title: Is there a way of having razor helpers outside of 'App_Code'?

    No, there isn't.