Include My Source Code (All) within the Help File

Topics: Developer Forum, User Forum
Dec 21, 2011 at 8:06 AM

Hi EveryOne,

first of i want to say it's a great project and very helpfull.

my problem is i want to list all source code within every class, Could you please tell me how can i do this?

Thanks in advance

Regards,

Ahmed Sobhy

 

Coordinator
Dec 21, 2011 at 3:33 PM

There are extension attributes supported by the Code Block Component that will allow you to import regions of code into an example section.  However, there is no way to automatically pull in all code for an entire project into the help file or code for each member.  You'd probably still need a custom build component to do that and way of mapping the member IDs to files and locations.

Eric

 

Dec 25, 2011 at 8:20 AM

Thanks Eric for your responce

i tried to use  Code Block Component  as the following:

        /// <summary>
        ///<code source="..\Default.aspx.cs" region="Events" lang="C#" title="Current Code" />
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        #region Events
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write("Hello SandCaslte");
        }
        #endregion

and i enabled the Code Block Component & Post-Transform Component but i can not find any code on the help file.

Could you please tell me how can i solve this? 

Thanks in advance.

Coordinator
Dec 26, 2011 at 4:05 PM

The <code> element is only rendered when embedded within an <example> element.  <summary> elements are best used for short descriptions of the member.  This should do what you need:

/// <summary>
/// This handles page load tasks
/// </summary>
/// <param name="sender">The sender of the event</param>
/// <param name="e">The event arguments</param>
/// <example>
/// <code source="..\Default.aspx.cs" region="Events" lang="C#" title="Current Code" />
/// </example>
#region Events
protected void Page_Load(object sender, EventArgs e)
{
    Response.Write("Hello SandCaslte");
}
#endregion


 Eric 

Dec 29, 2011 at 8:27 AM

Unfortunately the same result, i can not find any source code on the generated file.

The following block of code is the same on my project 

        /// <summary>
        /// This handles page load tasks
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        /// <example>
        /// <code source="..\Default.aspx.cs" region="Events" lang="C#" title="Current Code" />
        /// </example>
        #region Events
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write("Hello SandCaslte");
            TestMethod(2);
        }

Thanks in advance.

Coordinator
Dec 29, 2011 at 7:39 PM

Check the XML comments file to be sure the expected XML comments are there with the <code> element.  It could be that you just need to rebuild your project to regenerate the comments file.  Also, check the SHFB build log to be sure that it's picking up the right XML comments file.

Eric