How to prevent Visual Studio from "publishing" XML documentation files in web projects?
Assuming you're using distinct configurations for development and release (and whatever else), unchecking 'XML documentation file'/turning off generation for a specific configuration would prevent it being deployed when not needed. Another option would be a post-build action to delete the file/s.
The former of those two options seeming more elegant.
Is there a way to prevent Visual Studio from copying this file when publishing the ASP.NET project,
Turn XML docs off in Release mode
but still retain the benefit of XML documentation IntelliSense when developing?
Turn XML docs on / off in Debug mode. Intellisense will work either way.
There is another solution. Just include the following in your csproj file somewhere in the beginning:
<AllowedReferenceRelatedFileExtensions>.pdb</AllowedReferenceRelatedFileExtensions>
That's it. XML files will no longer be published. Of course, you can make it conditional on the concrete configuration.