Although I try to make my API’s as descriptive as possible, sometimes good documentation can still make a difference.
One way to enable documentation generation is through Visual Studio:
- Right click on your project and select Properties.
- On the Properties window go to the Build tab.
- Check the XML documentation file checkbox
- Don’t forget to save these changes.
As a result the following is added to your csproj file:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | |
<DocumentationFile>C:\Projects\Example\eShopExample.Infrastructure\eShopExample.Infrastructure.xml</DocumentationFile> | |
</PropertyGroup> |
There are a few things I don’t like about this:
- First a condition is applied to the PropertyGroup which doesn’t seem necessary
- Second an absolute path is used to define where to generate the documentation XML
So I would recommend no longer to use this approach. What you can do instead is directly manipulate the csproj file and add the following line to a PropertyGroup:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<GenerateDocumentationFile>true</GenerateDocumentationFile> |