Search code examples
asp.net-mvcasp.net-mvc-3nugetrazor-2mvcsitemapprovider

MvcSiteMapProvider Installation Error


I got this error while installing the sitemapprovider for mvc:

Install-Package : Updating 'Microsoft.AspNet.Razor 3.2.2' to 'Microsoft.AspNet.Razor 2.0.20505.0' failed. Unable to find versions of 
'Microsoft.AspNet.WebPages, Microsoft.AspNet.Mvc' that are compatible with 'Microsoft.AspNet.Razor 2.0.20505.0'.
At line:1 char:1
+ Install-Package MvcSiteMapProvider.MVC4
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

Solution

  • The error indicates you are installing the MvcSiteMapProvider.MVC4 NuGet package, but your project is MVC 5 (because it has Razor 3.2.2). You must install the package that matches your version of MVC (in this case, MvcSiteMapProvider.MVC5) into your project.

    PM> Install-Package MvcSiteMapProvider.MVC5
    

    Do note that the MvcSiteMapProvider NuGet package is obsolete and should not be installed into any project unless you intend to use MvcSiteMapProvider v3.x.

    If you are upgrading from MvcSiteMapProvider v3 to v4, please see the upgrade guide.