views:

665

answers:

3

Does anyone know of any tools that allow you to extract comments directly from a .cs file in to some simple text or even the clipboard? Even better if such a tool could work at the method level too.

I am not looking for something like Sandcastle that works at build time, I am looking for something that works on single source code files. Basically I need to copy a chunk of method signatures and the associated doc comments in to a text file, but I am getting bored of removing the "///" and reformating the lines. I'd love to be able to right click on a method and have a context menu item along the lines of "Copy documentation to Clipboard".

Do any such tools exist?

+3  A: 
Peter
Thanks Peter, this looks very interesting.
Steve Haigh
I'm not seeing any of the screenshot images I'm afraid.
Steve Haigh
mmm me neither now, but you can open them anyway (in ff : right mousebutton and open image in new tab)
Peter
A: 

comments form .cs files automatically goes to xml file. Below is the instructions:

  • Open the project properties -> Build
  • go to bottom, there is 'Output' section
  • Enable the checkbox for 'XML documentation file' and set the output path for this file
  • this file will have all the documentation of your code copied to it when you build the code.

Once you get all the comments from your project you can use it whatever way you want.

http://msdn.microsoft.com/en-us/magazine/cc302121.aspx

recommendation:

you can disable it during your day to day work, as if the project size is increased it will take time during the build to generate this file as it needs to fatch all the comments. Just run when you are releasing the code so that you get all the documentation.

Mutant
yes, but i think the point was that building should not be necesarry.
Peter
exactly. I already have docs generated at build time, but sometimesit would be handy just to pull method or class docs out without running a build.
Steve Haigh
+1  A: 

No need to roll your own, have a look at cr-documentor.

CR_Documentor is a plugin for DXCore that allows you to preview what the documentation will look like when it's rendered - in a tool window inside Visual Studio.

It works quite well, but I suspect it running along with Resharper is a bit shaky, so I disable it until I use it.

kay.herzam
Cool, thanks. Does this require a licence for CodeRush though?
Steve Haigh
You don't need CodeRush, just the DXCore, which is free.
kay.herzam
+1 for that then:-)
Steve Haigh
Yes, it really does not seem to like running alongside R#. Other than that it does just what I need. Thanks.
Steve Haigh