Method Not Found exception when trying to use MvcSiteMapProvider HTML helpers

Jun 13, 2011 at 8:51 PM

When I try to use helpers in my views (particularly, breadcrumbs via Html.MvcSiteMap().SiteMapPath() ) I get a Method Not Found exception. I have tried the other helpers as well and all give me the same exception. Interestingly, Visual Studio's Intellisense shows the methods when I am typing, but will not auto-complete them with tab/enter. The specific error message is as follows:

System.MissingMethodException: Method not found: 'Void System.Web.Mvc.WebFormView..ctor(System.String, System.String)'

I have added the reference to the dll file from the net40 folder. I have copy/pasted the root web.config data from the "Registering the provider" page. I have added the Mvc.sitemap file and constructed a simple node heirarchy (I also made sure that the site map address was set to http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0). I have added both namespaces to the Views/Web.config file, as specified on the "HtmlHelper functions" page (I'm using Razor).

Any idea what I'm doing wrong? Please let me know if you need more info from me.

Thanks

System.MissingMethodException: Method not found: 'Void System.Web.Mvc.WebFormView..ctor(System.String, System.String)'
System.MissingMethodException: Method not found: 'Void System.Web.Mvc.WebFormView..ctor(System.String, System.String)'
Coordinator
Jun 14, 2011 at 8:14 AM

What .NET version / MVC version are you using?

Jun 14, 2011 at 1:10 PM
Edited Jun 14, 2011 at 1:10 PM

I added MvcSiteMapProvider to my application using NuGet. That way some helper model files were automatically added to the Views/Shared folder of my application: MenuHelperModel.cshtml, MenuHelperModel.aspx, etc...  I deleted the .aspx files (because I'm using Razor) and moved the .cshtml files to Views/Shared/DisplayTemplates folder. Now it works.

Jun 14, 2011 at 1:35 PM
Edited Jun 14, 2011 at 2:15 PM

I'm using .NET 4.0 and MVC3. I'll give ValentinS's suggestion a try and see if that works.

UPDATE: Installing via NuGet as ValentinS suggested solved my problem. I must not have had the appropriate files in the DisplayTemplates folder.

Jun 25, 2011 at 1:30 PM
Edited Jun 25, 2011 at 1:32 PM

This error message needs to provide more information. Which view was it unable to find and where did it look? I have the issue in production but not in development, I verified all the view files were properly in DisplayTemplates... so what is it looking for?

 

Coordinator
Jun 29, 2011 at 11:20 AM

This is not really a view issue, more an issue with MVC2 vs MVC3. MVC3 and .NET 4 should not give this error.

@ValentinS: the NuGet package should install the correct version of MvcSiteMapProvider,  have a feeling you somehow installed the MVC2 version in your application?