1、Areas/HelpPage/App_Start/HelpPageConfig.cs
修改 public static void Register(HttpConfiguration config):
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/bin")));
path修改到bin目录下
2、Areas/HelpPage/XmlDocumentationProvider.cs
修改构造函数为:
public XmlDocumentationProvider(string documentPath)
{
if (documentPath == null)
{
throw new ArgumentNullException("documentPath");
}
var files = new[] { "adll.xml", "bdll.xml"};
foreach (var file in files)
{
var path = Path.Combine(documentPath, file);
if (File.Exists(path))
{
XPathDocument xpath = new XPathDocument(path);
_documentNavigators.Add(xpath.CreateNavigator());
}
}
}
var files = new[] { “adll.xml”, “bdll.xml”};中枚举出自己的dll的注释xml就好了。
然后增加方法:
private XPathNavigator SelectSingleNode(string selectExpression)
{
foreach (var navigator in _documentNavigators)
{
var propertyNode = navigator.SelectSingleNode(selectExpression);
if (propertyNode != null)
return propertyNode;
}
return null;
}
然后把其它调用_documentNavigator.SelectSingleNode(selectExpression)替换为SelectSingleNode(selectExpression)
这样,只要写好备注,生成dll时选择了XML文档文件,路径为bin目录下,help页的描述就自动生成了