Is it possible to generate XML documentation from assemblies made using reflection emit. VB and C# can do it. Is this feature inside the reflection classes?.- Edited byBorgdylan Monday, September 14, 2009 4:02 PMspelling
-
AnswersI guess you have assemblies saved to disk which were produced by Ref.Emit, correct? In that case you can use any disassembler (ildasm, Reflector). That's the best documentation you can get for existing assemblies, as assemblies don't contain any comments, just names of methods and names of (some) parameters.
C# and VB can generate XML documentation only from sources. If you don't have sources (like in Ref.Emit case), then you cannot produce any useful XML documentation.
-Karel - Proposed As Answer byKarel ZikmundMSFT, ModeratorMonday, September 14, 2009 5:01 PM
- Marked As Answer byeryangMSFT, ModeratorThursday, September 17, 2009 6:03 AM
-
Just experiment with it and you will find out that there is no fixed XML Schema for the doc. You can bing it- first result is documentation about C# XMLDocumentationComments, which leads you to XMLDocumentation format, that explains what C# puts into the XML Documentation file and how. Here's my quick experiment -it shows that also custom XML tags (myOwnTag) will be in the XML documentation file:
// HelloWorld.cs
/// <summary>
/// The main class with the entry point
/// </summary>
public class HelloWorld
{
/// <summary>
/// Entry point of the application.
/// </summary>
/// <param name="args">Arguments from the command line.</param>
/// <returns>App error code</returns>
/// <myOwnTag>Will this be included in the XML documentation?</myOwnTag>
public static int Main(string [] args)
{
return 0;
}
}
Run csc.exe /doc:Documentation.xml HelloWorld.cs
<?xml version="1.0"?>
<doc>
<assembly>
<name>HelloWorld</name>
</assembly>
<members>
<member name="T:HelloWorld">
<summary>
The main class with the entry point
</summary>
</member>
<member name="M:HelloWorld.Main(System.String[])">
<summary>
Entry point of the application.
</summary>
<param name="args">Arguments from the command line.</param>
<returns>App error code</returns>
<myOwnTag>Will this be included in the XML documentation?</myOwnTag>
</member>
</members>
</doc>
- Marked As Answer byBorgdylan Tuesday, September 22, 2009 3:25 PM
- Edited byKarel ZikmundMSFT, ModeratorThursday, September 17, 2009 4:42 PMSample formatting
- Proposed As Answer byKarel ZikmundMSFT, ModeratorThursday, September 17, 2009 4:42 PM
-
All RepliesI guess you have assemblies saved to disk which were produced by Ref.Emit, correct? In that case you can use any disassembler (ildasm, Reflector). That's the best documentation you can get for existing assemblies, as assemblies don't contain any comments, just names of methods and names of (some) parameters.
C# and VB can generate XML documentation only from sources. If you don't have sources (like in Ref.Emit case), then you cannot produce any useful XML documentation.
-Karel - Proposed As Answer byKarel ZikmundMSFT, ModeratorMonday, September 14, 2009 5:01 PM
- Marked As Answer byeryangMSFT, ModeratorThursday, September 17, 2009 6:03 AM
-
But I do have sources. The binaries are made by my compiler which processes source files. Is there an XML Schema for XML Documentation that I can use to learn its structure?
| | Borgdylan | Just experiment with it and you will find out that there is no fixed XML Schema for the doc. You can bing it- first result is documentation about C# XMLDocumentationComments, which leads you to XMLDocumentation format, that explains what C# puts into the XML Documentation file and how.
Here's my quick experiment -it shows that also custom XML tags (myOwnTag) will be in the XML documentation file:
// HelloWorld.cs
/// <summary>
/// The main class with the entry point
/// </summary>
public class HelloWorld
{
/// <summary>
/// Entry point of the application.
/// </summary>
/// <param name="args">Arguments from the command line.</param>
/// <returns>App error code</returns>
/// <myOwnTag>Will this be included in the XML documentation?</myOwnTag>
public static int Main(string [] args)
{
return 0;
}
}
Run csc.exe /doc:Documentation.xml HelloWorld.cs
<?xml version="1.0"?>
<doc>
<assembly>
<name>HelloWorld</name>
</assembly>
<members>
<member name="T:HelloWorld">
<summary>
The main class with the entry point
</summary>
</member>
<member name="M:HelloWorld.Main(System.String[])">
<summary>
Entry point of the application.
</summary>
<param name="args">Arguments from the command line.</param>
<returns>App error code</returns>
<myOwnTag>Will this be included in the XML documentation?</myOwnTag>
</member>
</members>
</doc>
- Marked As Answer byBorgdylan Tuesday, September 22, 2009 3:25 PM
- Edited byKarel ZikmundMSFT, ModeratorThursday, September 17, 2009 4:42 PMSample formatting
- Proposed As Answer byKarel ZikmundMSFT, ModeratorThursday, September 17, 2009 4:42 PM
-
Thanks Karel, that was exactly what I wanted to know. The xml makes a lot of sense. I just needed how it is formatted. I have worked with xml documents beforehand. You are the best. | | Karel Zikmund |
|