HtmlHelper does not contain a definition for .ShellInitializationScript()


I'm trying to add a new menuItem to the global navigation, following the example below:

Although then hitting these lines:


I get the following errors:

'HtmlHelper' does not contain a definition for 'ShellInitializationScript' and no extension method 'ShellInitializationScript' accepting a first argument of type 'HtmlHelper' could be found (are you missing a using directive or an assembly reference?)

Error CS1929 'HtmlHelper' does not contain a definition for 'GlobalMenu' and the best extension method overload 'MenuHelper.GlobalMenu(HtmlHelper)' requires a receiver of type 'HtmlHelper'

Entire code looks like this:

@using EPiServer.Framework.Web.Resources
@using EPiServer.Shell.Navigation




    @Html.Raw(ClientResources.RenderResources( "ShellCoreLightTheme"))

    @Html.Raw(ClientResources.RenderResources( "DojoDashboardCompatibility", new[] { ClientResourceType.Style }))


Anybody knows why?

Sep 25, 2017 14:55

Try adding a @using EPiServer.Shell.Web.Mvc.Html

Oct 04, 2017 18:08

Try adding a web.config on your Views folder where your module Index.cshtml is. The system needs to know which assembly to get the HtmlHelper from.

May 14, 2018 14:37

amazing article

Jul 05, 2018 7:11
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.