Question

On the one hand MSDN says:

The XML doc comments are not metadata; they are not included in the compiled assembly ...

But on the other hand, Intellisense shows them in Visual Studio for .net classes etc. (e.g. if you hover over Int32.)

To avoid misunderstandings: I'm referring to these:

/// <summary>
/// These comments.
/// </summary>
void example()
{
    //Not these.
}
Was it helpful?

Solution

The XML documentation files are separate from the DLLs for an assembly. They are just UTF8 XML Files. If they happen to be in the same folder as the DLL that they document, then Visual Studio will pick them up.

When you compile, the build process will copy the XML files into the build output folder automatically, if they exist.

None of the contents of the XML documentation ever gets put inside any DLL.

If you look at the framework DLL files (for example in "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0") you will see loads of ".xml" files next to them.

OTHER TIPS

No these are stripped when you compile your code to IL....Compile your code to a DLL or exe and then use the tool ILDasm to open it. You will notice you comments are not included. You could then decompile your code with a tool like Reflector and again see your comments are gone. ILDasm and Reflector are great tools in general you should become familiar with.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top