I'm trying to port a "classic" ASP.NET MVC view to Razor and got stuck when trying to use a traditional (non-Razor) Html helper method. The helper method has the following signature:
public static string WrappedValidationSummary(this HtmlHelper htmlHelper, string SummaryError)
{
...
}
The helper method does work fine when using it in regular (non-Razor) views.
When using it in the Razor view like this:
@Html.WrappedValidationSummary("Mitarbeiter konnnte nicht angelegt werden.");
I get a run-time error message that
'System.Web.Mvc.HtmlHelper' does not contain a definition for 'WrappedValidationSummary' and no extension method 'WrappedValidationSummary' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
The Razor syntax checker in Visual Studio and Intellisense have no problem finding my extension method's definition. Recompiling the project does not help.
What is going wrong?