Reputation: 750
We are using Swagger UI
documentation to describe our project API. Swagger have to read XML from projectname.xml
to show all the C.R.U.D. functions we have in project.
The problem is when I switch from Visual Studio to Visual Studio Code, it is not regenerating or changing existing XML file from Visual Studio Code. Is there the way to generate XML documentation file in Visual Studio Code like in Visual Studio Ultimate for instance, as shown the image below?
Upvotes: 7
Views: 4473
Reputation: 6026
You can use the <GenerateDocumentationFile>
property in the project file. This is a Boolean, and sets the DocumentationFile
property automatically.
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>1701;1702;1705;1591</NoWarn>
</PropertyGroup>
(Unfortunately, the Visual Studio project properties UI doesn't expose this improved way to enable XML documentation file generation yet. See this work item in the project system repo, and this pull request, which initially added the feature.)
Upvotes: 9
Reputation: 358
See David Waterworth's answer as it is more robust.
In your csproj file for the project, add the following.
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\netcoreapp2.0\TodoApi.xml</DocumentationFile>
</PropertyGroup>
Then rebuild your project.
Upvotes: 3
Reputation: 2881
The following is slightly more robust, it doesn't hard code the framework and project
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\$(TargetFramework)\$(MSBuildProjectName).xml</DocumentationFile>
<NoWarn>1701;1702;1705;1591</NoWarn>
</PropertyGroup>
Upvotes: 5