Error when upgrading to WebAPI 2.1 XmlDocumentationProvider does not implement interface member GetDocumentation

I’m following the tutorial here:

http://www.asp.net/web-api/overview/releases/whats-new-in-aspnet-web-api-21#download

I created an MVC Web Api project in Visual Studio 2012 (.NET Framework 4.5), and ran this command in my NuGet Package Manager Console Install-Package Microsoft.AspNet.WebApi

When I tried to build my project, I get this error:

'CommonServices.Areas.HelpPage.XmlDocumentationProvider' does not implement interface member 
    'System.Web.Http.Description.IDocumentationProvider.GetDocumentation(System.Web.Http.Controllers.HttpControllerDescriptor)' c:usersadministratordocumentsvisual studio 2012ProjectsCommonServicesCommonServicesAreasHelpPageXmlDocumentationProvider.cs

'CommonServices.Areas.HelpPage.XmlDocumentationProvider' does not implement interface member 
    'System.Web.Http.Description.IDocumentationProvider.GetResponseDocumentation(System.Web.Http.Controllers.HttpActionDescriptor)' c:usersadministratordocumentsvisual studio 2012ProjectsCommonServicesCommonServicesAreasHelpPageXmlDocumentationProvider.cs

Is there something I missed?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You can fix this issue by running the following two commands in the Package Manager Console

Install-Package Microsoft.AspNet.WebApi.HelpPage

This will install the required HelpPage components which are missing. You can then run an update on all NuGet Packages in your project in order to verify that all packages are up to date.

Update-Package -ProjectName 'YourProject' -Reinstall

(Remember to replace YourProject with the name of your actual project)

Update: If you continue to receive errors after building and running, you may need to update the Razor references in your Web.Config file to look like this

<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
  <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>

Method 2

I got the same problem when getting Microsoft.AspNet.WebApi.

At Nuget Package Manager Console write this:

Update-Package -ProjectName 'YourProjectNameGoesHere' -Reinstall

This will update all your packages and it will solve your problem.I hope it helps

Method 3

I got the same error. This is how fixed it.

Add these two methods to the ~AreasHelpPageXmlDocumentationProvider.cs class

    public virtual string GetDocumentation(HttpControllerDescriptor controllerDescriptor)
    {
        return "";
    }

    public virtual string GetResponseDocumentation(HttpActionDescriptor actionDescriptor)
    {
        return "";
    }

Obviously, I wouldn’t use this solution with real-world Enterprise applications since I don’t know if this breaks anything important. I would only do this if you’re running a test project or something. (although it looks like only some kind of Documentation is the only thing which is affected)

Method 4

Even after I run Update-Package -ProjectName 'YourProjectNameGoesHere' -Reinstall, still got the same problem.

run PM> install-package Microsoft.AspNet.WebApi.HelpPage, problem solved

Method 5

I was getting build error whenever i am adding any new package from the NuGet Package Manager. I fixed it by deleting the file (~AreasHelpPageXmlDocumentationProvider.cs) from the project and it worked for me.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x