I have ASP.NET Web API project and I want to add a Help page, but I want it to be in a separate project.
Is it possible ?
I have ASP.NET Web API project and I want to add a Help page, but I want it to be in a separate project.
Is it possible ?
You can re-write XmlDocumentationProvider
constructor to something like that:
public XmlDocumentationProvider(string appDataPath)
{
if (appDataPath == null)
{
throw new ArgumentNullException(nameof(appDataPath));
}
var files = new[] { "MyWebApiProject.xml" /*, ... any other projects */ };
foreach (var file in files)
{
var xpath = new XPathDocument(Path.Combine(appDataPath, file));
_documentNavigators.Add(xpath.CreateNavigator());
}
}
It will include all the xml documentation files that you list in the array. You should also make sure your target Web API project (and all the model projects if needed) generates documentation on build and copies it to the right location.
You should call WebApiConfig.Register from your Web API project in your help project:
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
GlobalConfiguration.Configure(MyApiProjectNamespace.WebApiConfig.Register);
}
© 2022 - 2024 — McMap. All rights reserved.