Reputation: 7949
I'm trying to set up the ASP.NET Help Pages to run in an existing MVC project, though pointing towards the documentation file from a Web API project in the same solution. Convention has the Help Pages running inside the Web API that it's documenting but in this case I want it in a sibling MVC project.
The Web API project outputs its documentation XML file in a folder within the MVC project.
I've installed the Microsoft.AspNet.WebApi.HelpPage NuGet package in the MVC project. This creates a class \Areas\HelpPage\App_Start\HelpPageConfig.cs
, and within this class's Register
method I've passed the XmlDocumentationProvider
the path to the Web API's documentation file.
But when I load the page, it's empty, aside from a title and a placeholder description.
Upon debugging the HelpController.Index
method, I can see in the returned IApiExplorer
that the _apiDescriptions
are empty.
However, if I install the Help Pages directly into the Web API project and debug the same method, I can see that the _apiDescriptions
are now present.
Can anyone explain what the Web API project is doing or has configured which the MVC project isn't doing or hasn't configured?
Upvotes: 4
Views: 5156
Reputation: 7172
I'm not sure if this will help anyone else that stumbles across this, I had started with a blank template from VS and added the help files via the Nuget package.
Because it was a blank template and I had no areas set up, it was missing the following from the global.asax
AreaRegistration.RegisterAllAreas();
This prevented the HelpPageConfig.Register from being called and thus, the Xml Documentation provider was never set.
Upvotes: 1
Reputation: 870
Just set this up myself, and I think I ran into a similar issue, if i'm reading what you're saying correctly.
Try the following:
//// Uncomment the following to use the documentation from XML documentation file.
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/ApiDocumentation.xml")));
This will hopefully fix your problem!
Upvotes: 8