Skip to content

Commit 53ffcbb

Browse files
authored
WN .NET 10 Prev 2: OpenAPI XML Doc Comments: Move to Include (#34988)
Running out of time, so merging this without a 2nd round.
1 parent 113ed43 commit 53ffcbb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

aspnetcore/release-notes/aspnetcore-10/includes/OpenApiPopulateXMLDocComments.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Populate XML doc comments into OpenAPI document
22

3-
ASP.NET Core OpenAPI document generation wlll now include metadata from XML doc comments on on method, class, and member definitions in the OpenAPI document. You must enable XML doc comments in your project file to use this feature. You can do this by adding the following property to your project file:
3+
ASP.NET Core OpenAPI document generation will now include metadata from XML doc comments on method, class, and member definitions in the OpenAPI document. You must enable XML doc comments in your project file to use this feature. You can do this by adding the following property to your project file:
44

55
```xml
66
<PropertyGroup>
@@ -10,19 +10,19 @@ ASP.NET Core OpenAPI document generation wlll now include metadata from XML doc
1010

1111
At build-time, the OpenAPI package will leverage a source generator to discover XML comments in the current application assembly and any project references and emit source code to insert them into the document via an OpenAPI document transformer.
1212

13-
Note that the C# build process does not capture XML doc comments placed on lamda expresions, so to use XML doc comments to add metadata to a minimal API endpoint, you must define the endpoint handler as a method, put the XML doc comments on the method, and then reference that method from the `MapXXX` method. For example, to use XML doc comments to add metadata to a minimal API endpoint originally defined as a lambda expression:
13+
Note that the C# build process does not capture XML doc comments placed on lambda expresions, so to use XML doc comments to add metadata to a minimal API endpoint, you must define the endpoint handler as a method, put the XML doc comments on the method, and then reference that method from the `MapXXX` method. For example, to use XML doc comments to add metadata to a minimal API endpoint originally defined as a lambda expression:
1414

1515
```csharp
1616
app.MapGet("/hello", (string name) =>$"Hello, {name}!");
1717
```
1818

19-
change the `MapGet` call to reference a method
19+
Change the `MapGet` call to reference a method:
2020

2121
```csharp
2222
app.MapGet("/hello", Hello);
2323
```
2424

25-
Then define the `Hello` method with XML doc comments:
25+
Define the `Hello` method with XML doc comments:
2626

2727
```csharp
2828
static partial class Program
@@ -42,9 +42,9 @@ static partial class Program
4242
}
4343
```
4444

45-
Here the `Hello` method is added to the `Program` class, but you can add it to any class in your project.
45+
In the previous example the `Hello` method is added to the `Program` class, but you can add it to any class in your project.
4646

47-
The example above illustrates the `<summary>`, `<remarks>`, and `<param>` XML doc comments.
47+
The previous example illustrates the `<summary>`, `<remarks>`, and `<param>` XML doc comments.
4848
For more information about XML doc comments, including all the supported tags, see the [C# documentation](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/recommended-tags).
4949

5050
Since the core functionality is provided via a source generator, it can be disabled by adding the following MSBuild to your project file.
@@ -66,7 +66,7 @@ The source generator process XML files included in the `AdditionalFiles` propert
6666
```
6767
<Target Name="AddXmlSources" BeforeTargets="CoreCompile">
6868
<ItemGroup>
69-
<AdditionalFiles Include="$(PkgSome_Package/lib/net10.0/Some.Package.xml" />
69+
<AdditionalFiles Include="$(PkgSome_Package)/lib/net10.0/Some.Package.xml" />
7070
</ItemGroup>
7171
</Target>
7272
```

0 commit comments

Comments
 (0)