Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

HtmlHelper does not contain a definition for .ShellInitializationScript()

Vote:
 

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

https://world.episerver.com/documentation/developer-guides/CMS/user-interface/Extending-the-navigation/

Although then hitting these lines:

@Html.Raw(Html.ShellInitializationScript())
@Html.Raw(Html.GlobalMenu())

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





    test

    

    
    @Html.Raw(ClientResources.RenderResources("ShellCore"))
    @Html.Raw(ClientResources.RenderResources("ShellWidgets"))

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

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


@Html.Raw(Html.ShellInitializationScript())
@Html.Raw(Html.GlobalMenu())
@RenderBody()

Anybody knows why?

#182581
Sep 25, 2017 14:55
Vote:
 

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

#183084
Oct 04, 2017 18:08
Vote:
 

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.

https://blog.nicolaayan.com/2018/05/episerver-htmlhelper-does-not-contain-a-definition-for-shellinitializationscript/

#192282
May 14, 2018 14:37
Vote:
 

amazing article

#194867
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.