This project has moved and is read-only. For the latest updates, please go here.

Using CompilerGeneratedAttribute for namespace summary

Topics: Developer Forum, Project Management Forum
Oct 13, 2011 at 7:41 PM

I'm trying to build top level namespace documentation.  Using version 4.1.2821.0 of System assembly, I'm getting an error on the CompilerGeneratedAttribute: The type or namespace name 'CompilerGeneratedAttributeAttribute' does not exist in the namespace 'System.Runtime.CompilerServices' (are you missing an assembly reference?)

    /// <summary>
    /// The Gadgeteer namespace contains classes used by <c>-</c> modules and mainboards.  Some classes, such as <see cref="Socket"/>
    /// and <see cref="SocketInterfaces"/>, are provided for manufacturers building mainboards, but others, such as <see cref="Color"/>,
    /// <see cref="Picture"/>, <see cref="StorageDevice"/>, and <see cref="Timer"/> are useful for users implementing <c>-</c> devices.
    /// </summary>
    class NamespaceDoc

Oct 13, 2011 at 8:44 PM

Based on the version number, it looks like you are using the .NET Micro Framework.  Perhaps that attribute doesn't exist in that framework yet.  I doubt it's a missing reference as it's usually found in mscorlib.  If it's not supported, you can work around it by excluding the NamespaceDoc classes with the ApiFilter project property or, if it's more convenient, by putting an <exclude /> tag on them in the code.



Oct 14, 2011 at 1:01 AM

Thanks, Eric.  You are correct, .NET Micro Framework.   I'll try your suggestions.

Oct 14, 2011 at 1:56 AM

I see now that you mean to exclude the namespace doc class in Sandcastle, but the reason I want to include it is to build a summary for the namespaces being documented.  I can't build the visual studio project with [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] in the source.

Oct 14, 2011 at 3:03 AM

Unless I'm not remembering correctly, it should still work.  SHFB will replace the IDs of the NamespaceDoc classes in the XML comments with the IDs of the containing namespace.  They will pass through and get used as the comments for the namespace topics.  The ApiFilter entries or <exclude /> tags will remove the classes from the reference documentation so that they don't appear as class entries in the namespaces.  Come to think of it, if you aren't documenting private members, they won't show up anyway.



Oct 14, 2011 at 3:45 AM

Very fine!  I left out [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] and I'm getting what I need at the top of my namespaces.  Thanks again.