How can the .NET source code XML comments be persisted in the assembly metadata?
-
05-07-2019 - |
Question
Have you noticed that for some methods in the system assemblies, the .NET Reflector also shows the respective documentation? Which means that the documentation can be persisted in the assembly metadata.
How can I make it work for my own assemblies? Meaning, I want to see my comments to my method when I reflect it in the .NET Reflector.
Thanks.
Solution
XML doc comments are not persisted in the assembly metadata. In fact, Visual Studio and other tools like Reflector locate XML doc comments by searching through a set of well-known paths that contain XML doc comment files.
If you want to view XML documentation for your own assemblies, make sure the XML file is in the same directory as the assembly being referenced, and shares the same name as your assembly (less the extension). For example, MyAssembly.Namespace.XML
corresponds to the MyAssembly.Namespace.dll
assembly.
See How to see XML comments of the code from Reflector for more information.