0

Basically, I was attempting to keep all of my documentation in a separate file and use the <include> tag. This would let me keep my source code free of documentation clutter. I still wanted a way to have some developer notes about classes and members, so I used the <devdoc> tag. The problem is now Visual Studio adds my developer notes to the xml documentation file. Is there any way to not have it compile into the xml documentation?

/// <devdoc>This is an interesting Foo class</devdoc>
/// <include file="docs.xml" path='Doc/Member[@for="MyNamespace.Foo"]/*' />
public class Foo { ... }

Which resulted in:

<member name="T:MyNamespace.Foo">
  <devdoc>This is an interesting Foo class</devdoc>
  <Summary>Some summary for testing.</Summary>
</member>

I realize that Sandcastle is not going to use the <devdoc> class when it generates its documentation, but if I want to give intellisense information about my library I need to include the generated xml file. If it's impossible, it's not the end of the world, but I'm hoping that there is a way to exclude it to begin with.

myermian
  • 31,823
  • 24
  • 123
  • 215

1 Answers1

0

I would create a simple console application that would be called from a post-build event. The application will remove all <devdoc> tags. It can be really simple. Just read the generated XML file and use regex like this:

using System.Text.RegularExpressions;

Regex regex = new Regex("<devdoc>(.|\n)*</devdoc>", RegexOptions.Compiled | RegexOptions.Multiline);
s = regex.Replace(s, string.Empty);

You can also use XmlDocument and its GetElementsByTagName method and then XmlNode.RemoveChild to remove the tags. But I believe regex would be more efficient.

Peter Macej
  • 4,831
  • 22
  • 49