asp.net-mvcrazorumbracoclient-dependency

ClientDependency.Core.Mvc error in body


We have a website made with Umbraco/Razor.

I upgraded the template with ClientDependency (Razor) as below.

@using ClientDependency.Core.Mvc

@{
    Layout = null;
    @Html.RequiresCss("~/css/normalize.css")
    @Html.RequiresCss("~/vendor/bootstrap-3.1.1/css/bootstrap.min.css")
    @Html.RequiresCss("~/vendor/font-awesome-4.0.3/css/font-awesome.min.css")
    @Html.RequiresCss("~/css/bootstrap.css")
    @Html.RequiresCss("~/css/RichTextEditor.css");
    @Html.RequiresJs("~/js/vendor/modernizr-2.6.2.min.js")
    @Html.RequiresJs("~/scripts/SubscribeProcess.js")
    @Html.RequiresJs("~/scripts/CookieMethods.js");
    @Html.RequiresJs("~/scripts/DownloadProcess.js");
}

I added this in the header

 @Html.RenderCssHere()
 @Html.RenderJsHere()

After running the website I get an message on top of the body.

System.Web.Mvc.HtmlHelper`1[Umbraco.Web.Models.RenderModel]
System.Web.Mvc.HtmlHelper`1[Umbraco.Web.Models.RenderModel]
System.Web.Mvc.HtmlHelper`1[Umbraco.Web.Models.RenderModel]
System.Web.Mvc.HtmlHelper`1[Umbraco.Web.Models.RenderModel]
System.Web.Mvc.HtmlHelper`1[Umbraco.Web.Models.RenderModel]
System.Web.Mvc.HtmlHelper`1[Umbraco.Web.Models.RenderModel]
System.Web.Mvc.HtmlHelper`1[Umbraco.Web.Models.RenderModel]
System.Web.Mvc.HtmlHelper`1[Umbraco.Web.Models.RenderModel]
System.Web.Mvc.HtmlHelper`1[Umbraco.Web.Models.RenderModel]

This message repeats 9-times. Just as the amount of file loaded with the @Html.RequiresCss or @Html.RequiresJs.

Does anyone have this issue or know an solution?

Thanks in advance!


Solution

  • The @ before Html.RequiresJs needs to be deleted.

    Result:

    @using ClientDependency.Core.Mvc
    
    @{
        Layout = null;
        Html.RequiresCss("~/css/normalize.css")
        Html.RequiresCss("~/vendor/bootstrap-3.1.1/css/bootstrap.min.css")
        Html.RequiresCss("~/vendor/font-awesome-4.0.3/css/font-awesome.min.css")
        Html.RequiresCss("~/css/bootstrap.css")
        Html.RequiresCss("~/css/RichTextEditor.css");
        Html.RequiresJs("~/js/vendor/modernizr-2.6.2.min.js")
        Html.RequiresJs("~/scripts/SubscribeProcess.js")
        Html.RequiresJs("~/scripts/CookieMethods.js");
        Html.RequiresJs("~/scripts/DownloadProcess.js");
    }