7

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?

visual studio xml documentation file

3
  • 1
    write tests rather than auto generated crap that no one will ever read or find useful. Commented Nov 28, 2016 at 2:52
  • tests are cool, and even so, i would like to know the answer to a question :) Commented Nov 28, 2016 at 2:59
  • 1
    tests are far from cool. But they can be great documentation. Commented Nov 28, 2016 at 3:22

3 Answers 3

9

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.)

Sign up to request clarification or add additional context in comments.

Comments

5

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>

Comments

3

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.