一个.Net项目(Sandcastle)上的命名空间文档? [英] Namespace documentation on a .Net project (Sandcastle)?

查看:127
本文介绍了一个.Net项目(Sandcastle)上的命名空间文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前开始使用 Sandcastle 为我们的一个项目生成文档网站。它的工作相当好,但我们一直只在我们的项目中为类,方法,属性(...)编写文档,并且为整个项目和项目部件/模块/命名空间提供了完全独立的文档。如果我可以将该文档合并在一起,并将相应的文档添加到生成的帮助文件中,那将是很好的,但我无法弄清楚如何做。



只需添加注释到命名空间声明似乎不起作用(C#):

  ///< summary> 
///我的短命名空间描述
///< / summary>
命名空间MyNamespace {...}

有谁知道如何做到这一点?我知道这是可能的,而且这样做真的很好:...

解决方案

Sandcastle还支持ndoc风格命名空间文档,它允许您将文档粘贴在源文件中:



只需在要记录的命名空间中创建一个名为NamespaceDoc的非公开类,并将xml该类的doc注释将用于命名空间。



使用[CompilerGenerated]属性装饰它,以防止类本身出现在文档中。



示例:

 命名空间Some.Test 
{
///< summary>
///< see cref =Some.Test/>命名空间包含....
///< / summary>

[System.Runtime.CompilerServices.CompilerGenerated]
class NamespaceDoc
{
}
}
/ pre>

SandCastle中的工作项目位于
here。


I started using Sandcastle some time ago to generate a Documentation Website for one of our projects. It's working quite well but we've always only written documentation for classes, methods, properties (...) in our project and had completely separate documentation for the overall project and project parts/modules/namespaces. It would be nice if I could merge that documentation together and add respective documentation to the generated helper files but I can't figure out how to do it.

Just adding comments to the namespace declaration doesn't seem to work (C#):

/// <summary>
/// My short namespace description
/// </summary>
namespace MyNamespace { ... }

Does anyone know how to do this? I know it's possible somehow and it would be really nice to have... :)

解决方案

Sandcastle also supports the ndoc-style namespace documentation, which allows you to stick the documentation in the source files:

Simply create a non-public class called NamespaceDoc in the namespace you want to document, and the xml doc comment for that class will be used for the namespace.

Adorn it with a [CompilerGenerated] attribute to prevent the class itself from showing up in the documentation.

Example:

namespace Some.Test
{
    /// <summary>
    /// The <see cref="Some.Test"/> namespace contains classes for ....
    /// </summary>

    [System.Runtime.CompilerServices.CompilerGenerated]
    class NamespaceDoc
    {
    }
}

The work item in SandCastle is located here.

这篇关于一个.Net项目(Sandcastle)上的命名空间文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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