Search code examples
asp.netasp.net-web-apivisual-studio-2013iis-8xml-documentation

Why is it so difficult to exclude XML documentation from a Release build?


Every time I Publish a Web Deployment Package using a Release Build I get this error once I call the Web API;

HTTP 500 Internal Server Error
Could not find file 'C:\SolutionDir\ProjectDir\bin\AssemblyName.xml'

Here is the steps I perform when deploying to the server.

  1. In Visual Studio 2013 right click Project and select Publish...
  2. Check I'm happy with my Publish Profile and click Publish.
  3. Locate the Deploy folder in my Web API Project and copy it to the destination (plus check backups of previous build).
  4. From the server I wish to deploy to I open up Internet Information Server and select the Application I wish to deploy to then right click select Deploy -> Import Application....
  5. Following the Import Application package wizard selecting my deployment package and checking any settings before clicking Finish.

After this process I attempt to test the Web API using Fiddler and receive the error mentioned above. I've tried various methods but nothing has worked so far, the only way I can make it work is by copying the XML files into the bin folder on the server from a Debug build of the project.

What I don't understand is I shouldn't need to do this to make it work, why does Visual Studio / Web Deployment insist the XML exists?

Solutions I've already tried


Solution

  • If you create a web API project with certain options it also includes MVC functionality to display web API help pages based on the XML documentation.

    I think the Nuget package that will be in the solution is called Microsoft.AspNet.WebApi.HelpPage.

    I've never used it, so I'm not up with when it may potentially check for the XML files, but perhaps removing this and the MVC stuff (if you do not use the documentation) will stop it looking for the XML files.