MenuHelper is an ambiguous reference between Sitecore.Web.UI.Controls.Navigation.Menus.MenuHelper and MvcSiteMapProvider.Web.Html.MenuHelper

After upgrading Sitecore from 7.5 to 8, whenever I tried to view the 'Experience Optimization' or ' Experience Analytics' pages from the Sitecore dashboard, I got this error: sitecore_menuhelper_error

Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0104: 'MenuHelper' is an ambiguous reference between 'Sitecore.Web.UI.Controls.Navigation.Menus.MenuHelper' and 'MvcSiteMapProvider.Web.Html.MenuHelper'

Source Error:

Line 23:   if (!string.IsNullOrEmpty(itemsDataSource))
Line 24:   {
Line 25:     userProfileKey = MenuHelper.GetUserProfileKey(itemsDataSource);
Line 26:     userProfileValue = ClientHost.Context.User.Profile.GetCustomProperty(userProfileKey);
Line 27:   }
As the exception suggest, the reason the page is falling over is because of an ambiguity in namespaces between 'Sitecore.Web.UI.Controls.Navigation.Menus.MenuHelper' and 'MvcSiteMapProvider.Web.Html.MenuHelper'. The project in question was using the MvcSiteMapProvider Nuget package which was causing a conflict. The only way to resolve this issue until a patch came out, was to add the full namespace to the enus\Menu.cshtml file. This file can be found here:
\sitecore\shell\client\Business Component Library\Layouts\Renderings\Navigation\Menus\Menu.cshtml
On line 25 add the code in bold: Line 25: userProfileKey = Sitecore.Web.UI.Controls.Navigation.Menus.MenuHelper.GetUserProfileKey(itemsDataSource); // with a full namespace included After doing that the site loaded.

Jon D Jones

Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge

Back to top