asp tutorials, asp.net tutorials, sample code, and Microsoft news from 15Seconds
Data Access  |   Troubleshooting  |   Security  |   Performance  |   ADSI  |   Upload  |   Email  |   Control Building  |   Component Building  |   Forms  |   XML  |   Web Services  |   ASP.NET  |   .NET Features  |   .NET 2.0  |   App Development  |   App Architecture  |   IIS  |   Wireless
 
Pioneering Active Server
 Power Search








Active News
15 Seconds Weekly Newsletter
• Complete Coverage
• Site Updates
• Upcoming Features

More Free Newsletters
Reference
News
Articles
Archive
Writers
Code Samples
Components
Tools
FAQ
Feedback
Books
Links
DL Archives
Community
Messageboard
List Servers
Mailing List
WebHosts
Consultants
Tech Jobs
15 Seconds
Home
Site Map
Press
Legal
Privacy Policy
internet.commerce














internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

HardwareCentral
Compare products, prices, and stores at Hardware Central!

Customizing the VBCommenter PowerToy
By Patrick Coelho
Rating: 4.2 out of 5
Rate this article


  • email this article to a colleague
  • suggest an article

    Technologies Covered

    • Visual Studio.NET 2003
    • VB.NET
    • XML
    • XSLT
    • VBCommenter v1.1
    • NDoc v1.2

    download source code
    download setup files

    Related Links

    Introduction

    Xml code commenting and automated code documentation was introduced in Visual Studio .NET Beta 1 for C# developers, a brilliant feature that with a little change in the "code commenting routine" made it possible for a developer to automatically generate documentation from comments embedded within the code. Moreover, it defined a consistent way of commenting code for all C# developers. For some reason the VB.NET development team at Microsoft still hasn't added this feature into the third release of the IDE, Visual Studio .NET 2003. But not to worry, Microsoft developers have developed a VB.NET code comment add-on to the IDE made available through www.gotDotNet.com.

    In this article we will take a closer look at code commenting, the gotDotNet "VBCommenter", modifying the VBCommenter so that the code comment layout and data generated are configurable, and using an open source documentation generator, "NDoc."

    When developing C# within the Visual Studio .NET Integrated Development Environment (IDE), Xml formatted comment sections are dynamically generated by entering a sequence of 3 slash characters ("/") above any code constructs. Visual Studio internally examines the construct and its signature and generates a simple XML Meta tag markup.

    Example:

    Function MemoryStream FileLoad(String sPath){ }

    By entering 3 slashes on the line prior to this method signature the following Xml markup is inserted automatically

    ///<summary>
    ///
    ///</summary>
    ///<param></param>
    ///<returns></returns>
    Function  MemoryStream FileLoad(String sPath) {  }
    
    The developer can then add a description in the summary section and provide further details including addition Xml markup.

    Note: A suggested collection of tags and their recommended usage can be found within the MSDN help files at: Ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/csref/html/vclrftagsfordocumentationcomments.htm

    Or online at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfTagsForDocumentationComments.asp

    It is also possible to have Visual Studio generate a single Xml document containing a compilation of all the XML meta data on build. An Xsl Transform can be applied to the Xml document to create a rather large Html document. Another option is to generate a comment Web site based on the project dll and XML code comments. The developer simply has to select "Tools" --> "Build Comment Web Pages" from within the IDE.

    It's important to note that "Comment Web Pages" are also available to VB .NET projects, however, any Xml comments added to code are ignored and not rendered within the comment Web pages.

    For the C# developer in Visual Studio, automated code documentation is relatively easy and a standard practice. But, out of the box Visual Studio does not provide this to VB .NET developers. For many, this is one important consideration when deciding which language to migrate to. However, this should not be a deciding factor The IDE development team at Microsoft built the development environment in a way so third party plug-ins could easily be created and integrated with the tool. Many third party add-ons were ready before Visual Studio .NET was first released.

    In fact Microsoft supports a Web site dedicated to .NET developer community driven projects, www.gotDotNet.com. The site consists of workgroups that focus on specific add-ons. Anyone can join these workgroups and contribute to the ongoing development of the add-ons.

    Since its first release there have been several third party Visual Studio add-ons and utilities built to add Xml documentation functionality for VB.NET developers; many can be found on the Web for a small fee. A solid entry into the foray is the "VBCommenter" from www.gotDotNet.com. This Visual Studio add-on is available as a free download. The workspace for the VBCommenter is active so the code base is constantly being updated. If you find a bug, you can check the bug tracking at the site to either report it or determine if there is a new version that includes the fix.

    So what exactly does the VBCommenter do?

    The VBCommenter provides automated Xml documentation within the IDE while writing VB .NET code. Once the add-on is installed, the developer simply types three VB.NET comment characters (''') prior to the start of any code construct and Xml formatted comment sections are dynamically generated.

    For example:

    Public function FileLoad(ByVal sPath as String) as Memorystream
    	' Code goes here ...
    End function
    
    After typing in three consecutive apostrophes prior to the function ( ''') the following markup will be inserted automatically:
    '''----------------------------------------------------------
    '''Project:	[project name]
    '''Function:  [Class name].FileLoad
    '''<summary>
    '''
    '''</summary>
    '''<param name="sPath"></param>
    '''<returns></returns>
    '''<history>
    '''     [logged in user name]  [date]  Created
    '''</history>
    '''-----------------------------------------------------------
    Public function FileLoad(ByVal sPath as String) as Memorystream
    	' Code goes here ...
    End function
    

    Note: The tool provides some customization. You can change the character sequence to a single apostrophe ('), an apostrophe followed by the "@" symbol ('@) or the default 3 apostrophes (''').

    As you can see there is a little more here than just empty XML. The Project Name is retrieved from the environment as well as class and function name. Note the history node. This node is configured in a way that it can be toggled on or off by selecting a check box within the IDE. Other data gathered, but not displayed, includes the param data type (a Boolean indicating if the param is a "Value" or "Reference" type parameter), and the data type the method returns. Also, note the dashed lines and the commented text that is not within XML tags:

    '''----------------------------------------------------------
    '''Project:	[project name]
    '''Function:  [Class name].FileLoad
    
    When the Xml document is generated, only the Xml tagged sections of the comment block are extracted. The rest is ignored. So it is possible to auto generate comments that are intended for the developer working with the code, and not the generated documentation.

    It should be apparent that this add-on gives the VB.NET developer more automated commenting power than what is built into C#. So what's the catch? There are a few:

    1. Since it is developed by a community, it is not supported by Microsoft. If you run into problems with it, your only recourse is to get help through the user group for the VBCommenter workspace on www.gotDotNet.com
    2. It's a work in progress, so it may have some shortcomings that are not readily apparent.
    3. It is built for Visual Studio .NET 2002 or 2003 only. There are different project files for each version. In this article we will only be working with the version for VS .NET 2003.
    4. There is no built in functionality for generating code documentation from the XML, and the "Build code comment pages" utility built into the IDE for C# won't evaluate the XML document generated by the VBCommenter.

    So, I have cool XML markup in my comments. What do I do with it?

    There are several Xslt style sheets available on the Web, and several utilities that can consume the Xml document and generate some code documentation. One of the better tools I've encountered is a tool called NDoc.

    Like the Power toys NDoc is built by a community of developers working out of a workspace at SourceForge (http://ndoc.sourceforge.net/). NDoc can be used to generate code documentation for several different environments and platforms. For .NET developers, MSDN-style compiled help files and a Web site that is similar to that generated by Visual Studio.NET's "Build Comment web pages"are just a few clicks away.

    Note: NDoc can also generate an MSDN-style compiled help file from the Xml generated by C#. C# document generation was built into NDoc way before VB commenting add-ons were available. NDoc itself is written in C#.

    If the VBCommenter is so good, why do we need to modify it? >>

  • Rate This Article
    Not HelpfulMost Helpful
    1 2 3 4 5
    Other Articles
    Feb 23, 2005 - My Feature in Visual Basic 2005
    In this article, Thiru Thangarathinam demonstrates the different classes and features available through the My namespace. By providing a speed-dial that allows you to more quickly and effectively utilize .NET framework functionalities in your application, the My feature provides huge productivity improvements for .NET developers.
    [Read This Article]  [Top]
    Oct 6, 2004 - Creating Triggers Using Managed Code in SQL Server 2005
    Thiru Thangarathinam discusses taking advantage of the integation between the .NET CLR and SQL Server 2005 in order to do things like create triggers using managed code.
    [Read This Article]  [Top]
    Sep 8, 2004 - Custom Object Data Binding with .NET
    Developers often use brute force coding to marshal data between the GUI and application objects. In this article, Luther Stanton explains how to use .NET's out-of-the box data-binding functionality to make this job much easier.
    [Read This Article]  [Top]
    Aug 17, 2004 - The Perfect Service - Part 2
    Ambrose Little provides the complete source code for his 'Perfect Service' and explains how the .NET Service Manager enables features such as drag-n-drop deployment.
    [Read This Article]  [Top]
    Aug 12, 2004 - Middle-Tier Hosting: Enterprise Services, IIS, DCOM, Web Services, and Remoting
    There is broad-reaching debate about remoting, Web services, Enterprise Services, and DCOM. In short, it is a debate about the best technology to use when implementing client/server communication in .NET. Rocky Lhotka shares his thoughts on the issue while offering clear explanations of basic application architecture terminology.
    [Read This Article]  [Top]
    Jul 21, 2004 - COM Interop Exposed
    This article provides and excellent foundation for COM Interop. It reviews COM's background, explains how VB6 interacts with COM, and then shows how to design .NET components to smoothly interact with COM.
    [Read This Article]  [Top]
    Jun 24, 2004 - The Perfect Service - Part 1
    The first article in this two-part series shows how to get Ambrose Little's .NET Service Manager running and then how to add plug-n-play services to it using drag-n-drop or XCOPY.
    [Read This Article]  [Top]
    May 25, 2004 - Generics In-Depth
    Although generics are extremely useful, they also seem to have a certain mystique that cannot be readily explained. This article hopes to remove that aura of mystery by showing just how easy it is to use generics and how useful they can be in many common situations.
    [Read This Article]  [Top]
    May 11, 2004 - SharePoint Security and .NET Impersonation
    When implementing custom components that require access to restricted resources, implicit impersonation must be used. Jay Nathan shows how to create a class that makes using .NET Impersonation a snap.
    [Read This Article]  [Top]
    Mar 23, 2004 - Exploiting .NET's Advanced Deployment Features
    Tony Arslan shows how to use VS .NET's custom deployment feature to create configuration files on the target machine during installation.
    [Read This Article]  [Top]
    Mailing List
    Want to receive email when the next article is published? Just Click Here to sign up.

    Support the Active Server Industry



    JupiterOnlineMedia

    internet.comearthweb.comDevx.commediabistro.comGraphics.com

    Search:

    Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

    Jupitermedia Corporate Info


    Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

    Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

    Solutions
    Whitepapers and eBooks
    Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
    Avaya Article: How to Feed Data into the Avaya Event Processor
    Microsoft Article: Install What You Need with Win Server ‘08
    HP eBook: Putting the Green into IT
    Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
    Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
    Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
    Avaya Article: Setting Up a SIP A/S Development Environment
    IBM Article: How Cool Is Your Data Center?
    Microsoft Article: Managing Virtual Machines with Microsoft System Center
    HP eBook: Storage Networking , Part 1
    Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
    MORE WHITEPAPERS, EBOOKS, AND ARTICLES
    Webcasts
    Intel Video: Are Multi-core Processors Here to Stay?
    On-Demand Webcast: Five Virtualization Trends to Watch
    HP Video: Page Cost Calculator
    Intel Video: APIs for Parallel Programming
    HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
    Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
    MORE WEBCASTS, PODCASTS, AND VIDEOS
    Downloads and eKits
    Sun Download: Solaris 8 Migration Assistant
    Sybase Download: SQL Anywhere Developer Edition
    Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
    Red Gate Download: SQL Compare Pro 6
    Iron Speed Designer Application Generator
    MORE DOWNLOADS, EKITS, AND FREE TRIALS
    Tutorials and Demos
    How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
    eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
    IBM Article: Collaborating in the High-Performance Workplace
    HP Demo: StorageWorks EVA4400
    Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
    Microsoft How-to Article: Get Going with Silverlight and Windows Live
    MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES