以编程方式在运行时获取的评论摘要 [英] Programmatically get Summary comments at runtime

查看:119
本文介绍了以编程方式在运行时获取的评论摘要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法以编程方式获得在ASP.net方法的XML的意见摘要部分。

我已经看过了previous相关的职位,他们不提供在网络环境中这样做的一种方式。

我不能使用任何第三方应用程序,并且由于网络环境Visual Studio插件的ARNT多兼用。

我已经找到工作解决方案最接近的是JimBlackler项目,但它只能在DLL的。

当然,类似的供应.CS文件,得到XML文档将是最优的。


现状

我有一个Web服务和即时通讯试图为它dynammically生成文档。

阅读方法和属性很容易,但让每个方法的总结是扔我赶走了一下。

  ///<总结>
///这是林试图读取
///< /总结>
公共类Some_Method(){}



解决方案

中的XML摘要不存储在.NET程序集 - 这是可选写入到一个XML文件作为构建的一部分(假设你使用Visual工作室)。

因此​​也没办法通过在编译的.NET程序集(无论是.exe或.dll)反射来拉出来每种方法的XML摘要 - 因为数据根本不存在为你拉了出来。如果你想要的数据,你必须在运行时构建环境指示输出XML文件作为构建过程的一部分,并解析这些XML文件来获得的摘要信息。

I'm looking for a way to programmatically get the summary portion of Xml-comments of a method in ASP.net.

I have looked at the previous related posts and they do not supply a way of doing so in a web environment.

I can not use any 3rd party apps and due to a web environment, Visual studio plugin's arnt much use either.

The closest thing i have found to a working solution was the JimBlackler project, but it only works on DLL's.

Naturally, something like 'supply .CS file, get XML documentation' would be optimal.


Current situation

I have a web-service and im trying to dynammically generate documentation for it.

Reading the Methods, and properties is easy, but getting the Summary for each method is throwing me off a bit.

/// <summary>
/// This Is what im trying to read
/// </summary>
public class Some_Method(){}


解决方案

The XML summary isn't stored in the .NET assembly - it's optionally written out to an XML file as part of your build (assuming you're using Visual Studio).

Consequently there is no way to "pull out" the XML summaries of each method via reflection on a compiled .NET assembly (either .EXE or .DLL) - because the data simply isn't there for you to pull out. If you want the data, you'll have to instruct your build environment to output the XML files as part of your build process and parse those XML files at runtime to get at the summary information.

这篇关于以编程方式在运行时获取的评论摘要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆