This project is read-only.

Generate Release notes with changesets and adding of custom fields in WorkItems

Jun 3, 2013 at 5:53 PM
This seems like a great tool but at this point in time. As we haven't even had a first cut of release yet, we are not using branches yet in TFS. Is there a way to generate report without having branch? I see in the previous posts you mentioned all one needs to do is change the xslt to include changeset? Could you provide an example, so I have an option to include/exclude changesets in the release notes report?

I am very happy to see that in the post below, there is a way to create custom fields to work items so that developers can populate "Release Notes" information. Could you show me an example how to achieve that? I assume this requires changing the TFS process template?
http://social.msdn.microsoft.com/Forums/en-US/devdocs/thread/d73e3fa6-b249-40cc-bf5f-bee0766833f2
Coordinator
Jun 10, 2013 at 3:19 PM
Hello,

It's true that current version of TFSChangeLog application does not generate report based Folder and it does need BRANCH selected for it. This is something we are going to change in future as we have this requirement in our back-log to support generation of report based on Folder selection. For now, I can only suggest that you introduce "MAIN" branch in your structure. You don't have to create sub branches like Integartion / Dev / Release etc. Just having "Main" branch would be sufficient.

NOTE: Before you perform following step take a back-up of your “C:\Program Files (x86)\TFSChangeLog\ReleaseNotesTemplate.xslt” file.

Secondly, I have produced few extra XSLT templates that you can use in your release notes generation process. They are now uploaded in the source code repository and can be downloaded from https://tfschangelog.codeplex.com/SourceControl/changeset/23646. Please note that to apply any of the given XSLT template, you will have to rename it to “ReleaseNotesTemplate.xslt” and copy it in the “C:\Program Files (x86)\TFSChangeLog\” directory. Basically, you are replacing existing template with the new one.

Thirdly, Yes, it’s true that you can introduce Custom Fields in TFS via Process Template customization. There are many books and online Blogs that describe how to change TFS WorkItems on a given project and in a given process template. To facilitate this, Microsoft has also provided us with TFS PowerTools that has Process Template Editor.

Once you have introduced custom field in your process template then that field will automatically get published in the base XML file when you generate Release Notes report via TFSChangeLog application. This XML base file is present in at … “C:\Users[USER_ID]\AppData\Local\TFSChangeLog\”. You will have to then modify your base “C:\Program Files (x86)\TFSChangeLog\ReleaseNotesTemplate.xslt” file to be able to include such custom fields in your final HTML output. XSLT is not that difficult and again there are lot’s of online documents and help available. If you find it difficult then just send me simple example of your XML file and let me know what you want to see in your HTML report. I will try to modify base XSLT and provide you with yet another one that you can try in your environment.

Hope this helps!

Best Regards,
TFSChangeLog Team.
Jun 11, 2013 at 1:58 PM
Thanks for making the templates available. They are very useful.
I think the one most informative in is the "ReleaseNotesTemplate - ChangeSetAndChildWorkItems" xslt template.

One thing I want to achieve though is to generate the release notes report not as html, but like a normal TEXT file.
I tried using the "ReleaseNotesTemplate - HTML_to_Text_Description" xslt template but I am still getting the html report.
Have I made the wrong assumption about what this xslt does? i.e. generating a Text report?
If so, is there a way to generate a simple text format report?
The main reason for this is the ease of editing and merging release notes

The other question I was asked is that when we end up with different branches, will the changeset tool be able to get changesets/workitems from work done on other branches? A simplified scenario would be like this
Main->Dev
Main->Release
A feature request is done in Dev, which merged into Main and then merged down to Release
If we run the tool on the Release Branch, would it be able to pick up the changeset done in Dev?
Coordinator
Jun 11, 2013 at 2:54 PM
Hi Brianyu,

In TFS 2010, description box was a simple text box and so it was easy to report it out as text.

In TFS 2012, description box is now HTML box and when you use default "ReleaseNotesTemplate.xslt" file that is bundled with installer then it does not convert HTML content to plain text. But "ReleaseNotesTemplate - HTML_to_Text_Description" is designed to convert description content from HTML to plain text (NOTE IT'S JUST DESCRIPTION BOX THAT IS COVERED BY THIS TEMPLATE. You will have to modify XSLT file to cover other fields that are of type HTML in TFS).

Regarding walking through different branches, It's bit tricky and does require more work to be done on the current version of TFSChangeLog. It does not support this feature for now. If you would like to see this feature implemented in future then I suggest that you cast you vote to this very same request that came from another user that can be found at https://tfschangelog.codeplex.com/workitem/1151

Best Regards,
TFSChangeLog Team.
Jun 11, 2013 at 3:04 PM
Thanks for getting back to me so quickly. yes I have casted my vote on the feature request.

We are still using TFS2010 so it's a plain text field for now.
We will be migrating to TFS2012 in the next month or two so this will be handy.

Sorry to ask again but is there a quick and easy way to generate the whole release notes report as a TEXT file?
I prefer html but others want a text file for easy editing/merging.
Coordinator
Jun 12, 2013 at 1:57 PM
Hi,

If you take out all HTML tags from the XSLT file then it shows output in textual format. But, in TFSChangeLog application, it's hard coded right now to SAVE output as .HTML file. If you simply rename this output file to .txt then you will see it fine in Notepad.

Following is an example XSLT code snippet.
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
    <xsl:output method="text"/>
    <xsl:template name="removeHtmlTags">
        <xsl:param name="html"/>
        <xsl:choose>
            <xsl:when test="contains($html, '&lt;')">
                <xsl:value-of select="substring-before($html, '&lt;')"/>
                <!-- Recurse through HTML -->
                <xsl:call-template name="removeHtmlTags">
                    <xsl:with-param name="html" select="substring-after($html, '&gt;')"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$html"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    <xsl:template match="/ChangeLog">
        <xsl:text>Release Notes Generated from TFS - TFS Change Log Report</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>TFS Server : </xsl:text>
        <xsl:apply-templates select="TFSServer/node()"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>Project Name : </xsl:text>
        <xsl:apply-templates select="TFSProjectName/node()"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>Branch Location : </xsl:text>
        <xsl:apply-templates select="TFSProjectBranchName/node()"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>Report Produced By : </xsl:text>
        <xsl:apply-templates select="ReportProducedBy/node()"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>From Changeset : </xsl:text>
        <xsl:apply-templates select="FromChangeSet/node()"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>To Changeset : </xsl:text>
        <xsl:apply-templates select="ToChangeSet/node()"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>Total Number of Changesets : </xsl:text>
        <xsl:value-of select="count(distinct-values(/ChangeLog//ChangeSet/ID))"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>Total Number of Work Items : </xsl:text>
        <xsl:value-of select="count(distinct-values(/ChangeLog/ChangeSets//WorkItems//WorkItem/_ID))"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>Changesets with associated Work Items : </xsl:text>
        <xsl:value-of select="count(/ChangeLog//ChangeSet[WorkItems/WorkItem/_ID[1] > 0])"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>Changesets without associated Work Items : </xsl:text>
        <xsl:value-of select="count(distinct-values(/ChangeLog//ChangeSet/ID)) - count(/ChangeLog//ChangeSet[WorkItems/WorkItem/_ID[1] > 0])"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>Report Date : </xsl:text>
        <xsl:apply-templates select="ReportDate/node()"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>=======================================================================================</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:for-each select="//WorkItem[not(preceding::WorkItem/_ID=./_ID)]">
            <xsl:sort select="_WorkItemType"/>
            <xsl:sort select="_ID" order="ascending"/>
            <xsl:text>Work Item ID : </xsl:text>
            <xsl:apply-templates select="_ID"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:text>Work Item Type : </xsl:text>
            <xsl:apply-templates select="_WorkItemType"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:text>Status : </xsl:text>
            <xsl:apply-templates select="_State"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:text>Title : </xsl:text>
            <xsl:apply-templates select="_Title"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:text>Assigned To : </xsl:text>
            <xsl:apply-templates select="_AssignedTo"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:text>Description : </xsl:text>
            <xsl:text>&#xa;</xsl:text>
            <xsl:if test="exists(_Description)">
                <xsl:variable name="PlainTextualDescription">
                    <xsl:call-template name="removeHtmlTags">
                        <xsl:with-param name="html" select="_Description"/>
                    </xsl:call-template>
                </xsl:variable>
                <xsl:value-of select="$PlainTextualDescription" disable-output-escaping="no"/>
                <xsl:text>&#xa;</xsl:text>
                <xsl:text>=======================================================================================</xsl:text>
                <xsl:text>&#xa;</xsl:text>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
XSLT is very powerful and it can generate output in many different formats from the base XML file. This is the main reason why we chose to use XSLT.

Best Regards,
TFS ChangeLog Team.
Marked as answer by Dharmesh_Shah on 10/15/2013 at 4:34 AM
Jun 14, 2013 at 10:06 AM
Thanks for getting back to me and showing me a way to generate text output.
I managed to generate a TEXT version of the release notes and it looks pretty cool, currently waiting for feedback.

My next step is to look at the TFS work item template and see if i can add the "Release Notes Comments" field.
If you could point me to any wiki or even an example on how it's done, that'll be great. I have changed the work item template before so i am reasonably comfortable with the concept.

Please see below an example of release notes our team used before.
I believe we have the "Changesets" section covered already by your report and the "Summary" section is the "Release Notes Comment"
Q) is there a way to add a hyperlink to the "Changesets" section so people can click on it and see the changeset details?
Q) Could the "Released" Section be ever automatic? or best to do it manually?



=============================================================================================================1.0.0 (01/06/2013)

Summary
  • Connect to Third party vendor xXX
  • Fix in generating report
Released
[ ] Clients
[X] App Servers
[ ] DB

Changesets
[Changeset 20178] 03/05/2013 08:05:33 brianyu [hyperlink to the work item] TFS work item info in text

[Changeset 20176] 03/05/2013 08:05:33 brianyu [hyperlink to the work item] TFS work item info in text

Coordinator
Jun 14, 2013 at 3:06 PM
Hi,

I will recommend you to have a look at http://msdn.microsoft.com/en-us/library/bb668982.aspx. It has detailed explanation about how to customize Process Template. PLUS have a look at Team Foundation Server Power Tools which is installed in your Visual Studio and it allows you to visually edit your process template and workitems within it.

Let me answer following questions inline...

Q) is there a way to add a hyperlink to the "Changesets" section so people can click on it and see the changeset details? - This is not supported in current version but it's something we should investigate. This feature will be useful for projects that are building software for internal company use. But for software that is developed for external customer, such a release notes hyperlink will not be helpful as customers will not be able to connect to your TFS and WorkItems wihtin it.
Q) Could the "Released" Section be ever automatic? or best to do it manually? - Currently, the best way is to do it manually. There are some thoughts that I have but it's difficult to explain that over such communication.

Best Regards,
TFSChangeLog Team.
Marked as answer by Dharmesh_Shah on 10/15/2013 at 4:34 AM