Friday, February 20, 2009

Code Documentation in Visual Basic .NET 2008

In Visual Studio 2008, Visual Basic finally inherited code documentation shortcuts. This is simply the very convenient mechanism by which typing 3 apostrophes on the line before a method declaration or similar will automatically resolve through intellisene or macroing or some kind of magic woven by the IDE pixies into a template for entering the documentation for that method.

For example:

''' <summary>
''' </summary>
''' <param name="id"></param>
''' <returns></returns>
''' <remarks></remarks>

Great stuff! As long as it's enabled. I had two projects in the one solution where typing ''' resolved into a documentor template as above for one of the projects, but merely sat there gathering dust in the other.

After spending more time than I care to admit trying to figure out what IDE settings option I needed to change in order to enable it, or even what library I needed to import in order to get it to work (yes, I was getting desperate and trying everything...) I found the solution, which in the end makes some sense but is definately lateral as an answer to this particular question.

I'd check the Project settings, but none of them were editor-related: they all seemed compile-related. Which they are. But it turns out that if you don't have "Generate XML document file" ticked in your Visual Basic project, the IDE won't offer up XML documentation comments to you.

No comments: