简体   繁体   中英

WebApi2 Help Page stops generating documentation after extending ApiController

I have extended ApiController to include some common properties/methods, and this extended controller is held in a separate class library/assembly.

public class ExtendedApiController : ApiController
{
    // shared properties...
}

In my Api project, all controllers inherit from this extended controller.

public class HomeApiController : ExtendedApiController
{
    // actions...
}

Pretty simple...

However, extending the base class now prevents the Help Page generator from actually generating documentation from these controllers. If I switch the controllers back to inheriting directly from ApiController they are visible in the docs.

Is there a way to allow/change the assembly name the generator looks for? I have a sneaking suspicion that it is comparing a base class directly to "ApiController" and is therefore skipping all of mine.

Well, as it turns out the fact that my base class was in a different assembly was part of the problem. The real issue was the fact that these projects referenced different versions of the WebApi2 libraries. Unfortunately, the conflicting package version was only listed as a warning, not an error, so I missed it. An update of all NuGet packages across all projects in the solution fixed the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM