Ten must-have .NET development gadgets (7): NDOC

zhaozj2021-02-16  84

Ten must-have .NET development gadgets (7): NDOC

Author: James Avery translation: lucentoff

Source: http://msdn.microsoft.com/msdnmag/issues/04/07/musthavetools/default.aspx declaration: The copyright belongs to the original author, reproduced please indicate the source!

NDOC

Writing code documents has always been a daunting task. Here I don't mean the initial document or more detailed design documentation, but the documentation of the Chinese method and attributes. NDOC tools can use reflection check assemblies and use XML documents generated from C # XML annotations to generate documents for your code. Currently only C # provides XML annotations, but using Visual Studio .NET Gadget VB Commenter enables Visual Basic .NET to have an XML annotation feature. In addition, the next release version of Visual Studio will support XML annotations for more languages.

use

NDOC

You easily form a document while writing code (in

Xml

Notes in the comment. need to use

NDOC

First of all

Visual studio.net

Open the assembly

Xml

Note Generate function. Right click on the project, choose

Properties | Configuration Properties | Build

, Then in "

XML Documentation File

"Enter the input save

Xml

The path of the file. When the project is compiled, you will create a

Xml

Annotate

Xml

file. Below is

NUnit

A method in the example

Xml

Documentation:

///

/// THIS TEST ADDS A Number of Values ​​To The Hashtable Collection

/// and the retrieves those value and checks if the match.

///

[TEST]

Public void hashtableaddtest ()

{

//Method Body Here

}

The XML document of this method will be extracted and saved in an XML file, as shown below:

THIS TEST ADDS A Number of Values ​​To The Hashtable Collection

And the Retrieves Those Values ​​and Checks if the match.

NDOC uses reflection to view the assembly and then read XML in the document and match. NDOC can use this data to create a variety of different document formats, including MSDN-style HTML Help File Format (.CHM), Visual Studio .NET Help File Format (HTML Help 2), etc. After generating an XML file, the next step is to load the assembly and the XML file into the NDOC for processing. The operation is simple, just open ndoc and click the "Add" button, then add related files.

Once the assembly and the XML file are loaded in NDOC and custom output according to the attribute range, click the "Generate" button to start generating a document. With the default properties, NDOC generates some very useful .html and .chm files, which automatically complete annoying tasks in a fast and effective way.

NDOC

Is an open source project, download URL:

http://ndoc.sourceforge.net/

.

转载请注明原文地址:https://www.9cbs.com/read-16928.html

New Post(0)