2

This is a picture of the code config file path of XML comment file. enter image description here

When I deploy in Azure, I have a problem that It can't find this XML file enter image description here

1
  • I try to add XML file into a wwwroot folder and it's not working too...someones meets this case like me.... Commented Aug 16, 2021 at 2:03

1 Answer 1

3

XML comments can be enabled with the following approaches:

Right-click the project in Solution Explorer and select Edit <project_name>.csproj. Manually add the highlighted lines to the .csproj file:

<PropertyGroup>
  <GenerateDocumentationFile>true</GenerateDocumentationFile>
  <NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>





public void ConfigureServices(IServiceCollection services)
    {
         .......//swagger config..
     var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
            var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
            c.IncludeXmlComments(xmlPath);

Then you can read the xml: enter image description here

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

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.