1

I have a WebApi(2 - I think but who knows what that means) project (this is based on a VS 2019 template) that I'm trying to add Xml Documentation to but I can't get the Xml file to generate.

I have this line uncommented in HelpPageConfig.cs

config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));

I have the appropriate checkbox in my Build properties checked (for debug and release)

Output Options

I have also added the appropriate comments to all Controllers and Actions but when I build, the Xml file does not get generated and hence I get an exception at runtime

System.IO.FileNotFoundException: 'Could not find file 'C:\Users\steve\source\repos\EcmApi\EcmApi\App_Data\XmlDocument.xml'.'

I've seen a lot of questions surrounding Publishing (not my problem...yet) and a lot of mentions of something called Swagger (I presume the predecessor to this) but nothing about the file just not being generated at all.

1 Answer 1

2

It seems that, and I'm not sure how or when, the filename in the HelpPageConfig.cs file and the filename in the build properties got mismatched. Once I made sure those paths were the same, things worked.

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.