1

I have a MVC 2 project created in Visual Studio 2010 that use MvcSiteMapProvider.dll and works fine. But when loading the project in Visual Studio 2013, everything else work fine except it crashes at

Html.MvcSiteMap().SiteMapPath

The error message is

An exception of type 'MvcSiteMapProvider.MvcSiteMapException' occurred in MvcSiteMapProvider.dll but was not handled in user code

I believe that MvcSiteMapProvider.dll cannot be loaded correctly. I need help on this. Thanks.

  • Did you updated the dll to the latest version ? – Amal Dev May 17 '15 at 07:22
  • There is a separate DLL for each .NET framework version, and I suspect you are targeting the wrong framework. This issue has nothing to do with the version of Visual Studio you are using. – NightOwl888 May 17 '15 at 12:55
  • Thanks, it's working now. If you post it as an answer, I will check it. –  May 19 '15 at 04:13

1 Answers1

0

Note that there is a separate DLL for each .NET framework version, and I suspect you are targeting the wrong framework. This can happen if you install MvcSiteMapProvider into your project and then change it to a different .NET framework version.

NuGet does not automatically upgrade/downgrade packages to the currently set framework version. This step must be done manually. The best way is to completely uninstall and reinstall the package as per this document. Also be sure to read this before attempting it.

But do note that if you do this NuGet will not remove any files you have changed (like Mvc.sitemap) and then prompt you whether to overwrite them. You should normally say no to each prompt to ensure your custom configuration is not overwritten.

Also note that it is not sufficient to use Assembly Binding Redirection with MvcSiteMapProvider because with each .NET framework version we create a separate build (DLL) that takes advantage of features that are not present in prior versions.

Community
  • 1
  • 1
NightOwl888
  • 55,572
  • 24
  • 139
  • 212