Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving XML comments to a separate file

I love XML comments. However, with everything collapsed, every two lines looks like:

[/// summary ...]
public void CreateUser(string username, string password)[...]

Multiply this by tens or hundreds of methods, and the resulting collapsed code is hard to sift through. Can I move these comments to a separate XML file, and still have Visual Studio recognize the association so that they still show up in the Intellisense? If so, how do I make that association? And I'm also using SandCastle to generate documentation based on these comments, so the association will have to be recognized by SandCastle as well.

like image 246
CptSupermrkt Avatar asked Jul 18 '12 01:07

CptSupermrkt


2 Answers

You can use the <include file='...' path='...'> tag to refer to external comments. See http://msdn.microsoft.com/en-us/library/9h8dy30z.aspx.

I do not know of any tool that will move the comments in existing source file to an external comment file.

like image 155
Richard Schneider Avatar answered Nov 18 '22 11:11

Richard Schneider


I'm probably 7 years late but I wanted to do the same and I found a way to get all the documentation in one XML but you may have to do the rest manually, add to the .csproj file the following:

  <PropertyGroup>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    <NoWarn>$(NoWarn);1591</NoWarn>
  </PropertyGroup>

And when you build your project, you're going to find in the output directory a <ProjectName>.xml file which will contain all your inline docs, you can copy the content of this file (You may have to edit some tags in the xml but probably not much) and place them in a file in your project.

Then you can replace the existing docs with the <include> tag.

like image 33
Omar Mneimneh Avatar answered Nov 18 '22 10:11

Omar Mneimneh