Skip to content

Commit d65cb84

Browse files
authored
move seealso tag outside summary (dotnet#18822)
1 parent 456c099 commit d65cb84

File tree

4 files changed

+28
-32
lines changed

4 files changed

+28
-32
lines changed

docs/framework/reflection-and-codedom/how-to-create-an-xml-documentation-file-using-codedom.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ helpviewer_keywords:
1010
- "Code Document Object Model, generating XML documentation"
1111
ms.assetid: e3b80484-36b9-41dd-9d21-a2f9a36381dc
1212
---
13-
# How to: Create an XML Documentation File Using CodeDOM
13+
# How to: Create an XML documentation file using CodeDOM
14+
1415
CodeDOM can be used to create code that generates XML documentation. The process involves creating the CodeDOM graph that contains the XML documentation comments, generating the code, and compiling the generated code with the compiler option that creates the XML documentation output.
1516

16-
### To create a CodeDOM graph that contains XML documentation comments
17+
## Create a CodeDOM graph
1718

1819
1. Create a <xref:System.CodeDom.CodeCompileUnit> containing the CodeDOM graph for the sample application.
1920

@@ -22,27 +23,28 @@ CodeDOM can be used to create code that generates XML documentation. The process
2223
[!code-csharp[CodeDomHelloWorldSample#4](../../../samples/snippets/csharp/VS_Snippets_CLR/CodeDomHelloWorldSample/cs/program.cs#4)]
2324
[!code-vb[CodeDomHelloWorldSample#4](../../../samples/snippets/visualbasic/VS_Snippets_CLR/CodeDomHelloWorldSample/vb/program.vb#4)]
2425

25-
### To generate the code from the CodeCompileUnit
26+
### Generate the code from the CodeCompileUnit
2627

2728
1. Use the <xref:System.CodeDom.Compiler.CodeDomProvider.GenerateCodeFromCompileUnit%2A> method to generate the code and create a source file to be compiled.
2829

2930
[!code-csharp[CodeDomHelloWorldSample#5](../../../samples/snippets/csharp/VS_Snippets_CLR/CodeDomHelloWorldSample/cs/program.cs#5)]
3031
[!code-vb[CodeDomHelloWorldSample#5](../../../samples/snippets/visualbasic/VS_Snippets_CLR/CodeDomHelloWorldSample/vb/program.vb#5)]
3132

32-
### To compile the code and generate the documentation file
33+
### Compile the code and generate the documentation file
3334

3435
1. Add the **/doc** compiler option to the <xref:System.CodeDom.Compiler.CompilerParameters.CompilerOptions%2A> property of a <xref:System.CodeDom.Compiler.CompilerParameters> object and pass the object to the <xref:System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile%2A> method to create the XML documentation file when the code is compiled.
3536

3637
[!code-csharp[CodeDomHelloWorldSample#6](../../../samples/snippets/csharp/VS_Snippets_CLR/CodeDomHelloWorldSample/cs/program.cs#6)]
3738
[!code-vb[CodeDomHelloWorldSample#6](../../../samples/snippets/visualbasic/VS_Snippets_CLR/CodeDomHelloWorldSample/vb/program.vb#6)]
3839

39-
## Example
40-
The following code example creates a CodeDOM graph with documentation comments, generates a code file from the graph, and compiles the file and creates an associated XML documentation file.
40+
## Example
41+
42+
The following code example creates a CodeDOM graph with documentation comments, generates a code file from the graph, and compiles the file and creates an associated XML documentation file.
4143

4244
[!code-csharp[CodeDomHelloWorldSample#1](../../../samples/snippets/csharp/VS_Snippets_CLR/CodeDomHelloWorldSample/cs/program.cs#1)]
4345
[!code-vb[CodeDomHelloWorldSample#1](../../../samples/snippets/visualbasic/VS_Snippets_CLR/CodeDomHelloWorldSample/vb/program.vb#1)]
4446

45-
The code example creates the following XML documentation in the HelloWorldDoc.xml file.
47+
The code example creates the following XML documentation in the *HelloWorldDoc.xml* file.
4648

4749
```xml
4850
<?xml version="1.0" ?>
@@ -54,8 +56,8 @@ CodeDOM can be used to create code that generates XML documentation. The process
5456
<member name="T:Samples.Class1">
5557
<summary>
5658
Create a Hello World application.
57-
<seealso cref="M:Samples.Class1.Main" />
58-
</summary>
59+
</summary>
60+
<seealso cref="M:Samples.Class1.Main" />
5961
</member>
6062
<member name="M:Samples.Class1.Main">
6163
<summary>
@@ -67,12 +69,12 @@ CodeDOM can be used to create code that generates XML documentation. The process
6769
</doc>
6870
```
6971

70-
## Compiling the Code
72+
## Compile permissions
7173

72-
- This code example requires the `FullTrust` permission set to execute successfully.
74+
This code example requires the `FullTrust` permission set to execute successfully.
7375

7476
## See also
7577

76-
- [Documenting Your Code with XML](../../visual-basic/programming-guide/program-structure/documenting-your-code-with-xml.md)
77-
- [XML Documentation Comments](../../csharp/programming-guide/xmldoc/index.md)
78-
- [XML Documentation](/cpp/ide/xml-documentation-visual-cpp)
78+
- [Document your code with XML (Visual Basic)](../../visual-basic/programming-guide/program-structure/documenting-your-code-with-xml.md)
79+
- [XML documentation comments](../../csharp/programming-guide/xmldoc/index.md)
80+
- [XML documentation (C++)](/cpp/ide/xml-documentation-visual-cpp)

docs/visual-basic/programming-guide/program-structure/documenting-your-code-with-xml.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@ helpviewer_keywords:
77
- "Visual Basic code, documenting with XML"
88
ms.assetid: a0d35dc7-c5f9-4d74-92ff-a1c6f28d5235
99
---
10-
# Documenting Your Code with XML (Visual Basic)
10+
# Document your code with XML (Visual Basic)
1111

12-
In Visual Basic, you can document your code using XML
12+
In Visual Basic, you can document your code using XML.
1313

14-
## XML Documentation Comments
14+
## XML documentation comments
1515

16-
Visual Basic provides an easy way to automatically create XML documentation for projects. You can automatically generate an XML skeleton for your types and members, and then provide summaries, descriptive documentation for each parameter, and other remarks. With the appropriate setup, the XML documentation is automatically emitted into an XML file with the same name as your project and the .xml extension. For more information, see [-doc](../../reference/command-line-compiler/doc.md).
16+
Visual Basic provides an easy way to automatically create XML documentation for projects. You can automatically generate an XML skeleton for your types and members, and then provide summaries, descriptive documentation for each parameter, and other remarks. With the appropriate setup, the XML documentation is automatically emitted into an XML file with the same root file name as your project. For more information, see [-doc](../../reference/command-line-compiler/doc.md).
1717

1818
The XML file can be consumed or otherwise manipulated as XML. This file is located in the same directory as the output .exe or .dll file of your project.
1919

2020
XML documentation starts with `'''`. The processing of these comments has some restrictions:
2121

2222
- The documentation must be well-formed XML. If the XML is not well formed, a warning is generated and the documentation file contains a comment saying that an error was encountered.
2323

24-
- Developers are free to create their own set of tags. There is a recommended set of tags (see "Related Sections" in this topic). Some of the recommended tags have special meanings:
24+
- Developers are free to create their own set of tags. There is a recommended set of tags (see [XML Comment Tags](../../language-reference/xmldoc/index.md)). Some of the recommended tags have special meanings:
2525

2626
- The \<param> tag is used to describe parameters. If used, the compiler will verify that the parameter exists and that all parameters are described in the documentation. If the verification fails, the compiler issues a warning.
2727

2828
- The `cref` attribute can be attached to any tag to provide a reference to a code element. The compiler verifies that this code element exists. If the verification fails, the compiler issues a warning. The compiler also respects any `Imports` statements when looking for a type described in the `cref` attribute.
2929

3030
- The \<summary> tag is used by IntelliSense in Visual Studio to display additional information about a type or member.
3131

32-
## Related Sections
32+
## Related sections
3333

3434
For details on creating an XML file with documentation comments, see the following topics:
3535

samples/snippets/csharp/VS_Snippets_CLR/CodeDomHelloWorldSample/cs/program.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ static void Main(string[] args)
2222

2323
cu = BuildHelloWorldGraph();
2424

25-
//<Snippet5>
25+
//<Snippet5>
2626
StreamWriter sourceFile = new StreamWriter(sourceFileName);
2727
provider.GenerateCodeFromCompileUnit(cu, sourceFile, null);
2828
sourceFile.Close();
29-
//</Snippet5>
29+
//</Snippet5>
3030

3131
//<Snippet6>
3232
CompilerParameters opt = new CompilerParameters(new string[]{
@@ -82,9 +82,9 @@ public static CodeCompileUnit BuildHelloWorldGraph()
8282
class1.Comments.Add(new CodeCommentStatement("<summary>", true));
8383
class1.Comments.Add(new CodeCommentStatement(
8484
"Create a Hello World application.", true));
85+
class1.Comments.Add(new CodeCommentStatement("</summary>", true));
8586
class1.Comments.Add(new CodeCommentStatement(
8687
@"<seealso cref=" + '"' + "Class1.Main" + '"' + "/>", true));
87-
class1.Comments.Add(new CodeCommentStatement("</summary>", true));
8888

8989
// Add the new type to the namespace type collection.
9090
samples.Types.Add(class1);

samples/snippets/visualbasic/VS_Snippets_CLR/CodeDomHelloWorldSample/vb/program.vb

+3-9
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Imports System.CodeDom.Compiler
44
Imports System.IO
55
Imports System.Text.RegularExpressions
66

7-
8-
97
Class Program
108
Private Shared providerName As String = "vb"
119
Private Shared sourceFileName As String = "test.vb"
@@ -21,7 +19,6 @@ Class Program
2119
cu = BuildHelloWorldGraph()
2220

2321
'<Snippet5>
24-
2522
Dim sourceFile As New StreamWriter(sourceFileName)
2623

2724
LogMessage("Generating code...")
@@ -56,10 +53,8 @@ Class Program
5653

5754
End Sub
5855

59-
6056
'<Snippet2>
61-
' Build a Hello World program graph using
62-
' System.CodeDom types.
57+
' Build a Hello World program graph using System.CodeDom types.
6358
Public Shared Function BuildHelloWorldGraph() As CodeCompileUnit
6459
' Create a new CodeCompileUnit to contain
6560
' the program graph.
@@ -80,10 +75,10 @@ Class Program
8075
class1.Comments.Add(New CodeCommentStatement("<summary>", True))
8176
class1.Comments.Add(New CodeCommentStatement( _
8277
"Create a Hello World application.", True))
78+
class1.Comments.Add(New CodeCommentStatement("</summary>", True))
8379
class1.Comments.Add(New CodeCommentStatement( _
8480
"<seealso cref=" & ControlChars.Quote & "Class1.Main" & _
8581
ControlChars.Quote & "/>", True))
86-
class1.Comments.Add(New CodeCommentStatement("</summary>", True))
8782

8883
' Add the new type to the namespace type collection.
8984
samples.Types.Add(class1)
@@ -139,7 +134,6 @@ Class Program
139134

140135
End Sub
141136

142-
143137
Shared Sub OutputResults(ByVal results As CompilerResults)
144138
LogMessage(("NativeCompilerReturnValue=" & _
145139
results.NativeCompilerReturnValue.ToString()))
@@ -150,4 +144,4 @@ Class Program
150144

151145
End Sub
152146
End Class
153-
'</Snippet1>
147+
'</Snippet1>

0 commit comments

Comments
 (0)