Search code examples
c#.netapi-doc

XML documentation not found when publishing a .Net Framework web API?


I scratched my head over this one for a few hours. I followed Microsoft's tutorial on adding API documentation. That all worked as expected on my local machine, but when published to my production IIS server, I got an error saying the XmlDocument.xml could not be found.


Solution

  • Although enabling the "XML documentation file" checkbox in the project properties > build > output section does create the file, it does not add it to the project for some reason. That's why the App_Data folder in my solution explorer was empty.

    The solution is simple. Right-click on the App_Data folder and select the add existing item option. Select the generated XML documentation file in the "App_Data" folder of your project's build location. Publish again.

    I hope someone can find this useful.