Friday, August 23, 2013

Getting detailed TFS build log ActivityLog.xml information via APIs

The TFS Build Activity logs have lots of useful information.  Unfortunately this information is not real easy to get to.  Using the TFS 2012 APIs we can pull the log info out of the TFS SQL DB without having access to the DB.  This makes it nice because we also don't have to try to parse the activitylog.xml files.

Once you have the information you can start to track and trend how long each TFS build definition takes at each part of the build.  Once you have that piece of data you can start to determine where the best place to optimize to further reduce build times.

The sample code below looks up the LKG build based off the build Definition.  The LKG (Last Known Good) build will be set based on the last build for that build definition that passed/succeeded. It will do a simple output of the activity name and the time it took to complete.  You can take this data along with the buildDetail and create a gantt chart that shows time for each step.

The build may be old (aka not a current LKG) depending on how your system works.  But I found it is the best place to start.  It might be useful for some teams to import all build (success and fail) so you can determine if there is a trend area of where things are failing.


Usings and references
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Client;
logic
 
            Uri tfsCollectionURL = new Uri("http://TFSSERVER:8080/tfs/TFSTPC");
            string tfsProjectName = "TFSPROJECTNAME";

            string buildDefName = "BUILDDEFINITIONNAME";
            var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsCollectionURL);


            IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
            var _buildDefinitions = buildServer.QueryBuildDefinitions(tfsProjectName);
            foreach (var buildDefinition in _buildDefinitions)
            {
                if (buildDefinition.LastGoodBuildUri == null)
                    continue;

                var build = buildServer.GetBuild(buildDefinition.LastGoodBuildUri);
                IBuildDetail buildDetail = buildServer.GetAllBuildDetails(build.Uri);

                var activityTrackingNodes = InformationNodeConverters.GetActivityTrackingNodes(buildDetail);

                foreach (var activity in activityTrackingNodes)
                {
                    if (activity.State != "Canceled" && (activity.Node.Children.Nodes.Count() == 0 || (activity.Node.Children.Nodes.Any(x => x.Type == "BuildMessage") && activity.DisplayName != "Sequence")))
                    {
                        if (activity.FinishTime.ToString() == "1/1/0001 12:00:00 AM")
                            continue;

                        Console.WriteLine(activity.DisplayName + ":" + (activity.FinishTime - activity.StartTime));
                    }

                }
            }

76 comments:

Smith said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.
or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

sathya shri said...
This comment has been removed by the author.
Unknown said...

Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

rpa training in chennai | rpa training in chennai
rpa training in pune | rpa online training | rpa training in bangalore

shalinipriya said...

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.


Data Science Training in Chennai | Data Science course in anna nagar
Data Science course in chennai | Data science course in Bangalore
Data Science course in marathahalli | Data Science course in btm

Unknown said...

All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.
java training in chennai | java training in bangalore


java training in tambaram | java training in velachery

Unknown said...

Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
python training Course in chennai | python training in Bangalore | Python training institute in kalyan nagar

Unknown said...

Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
Online DevOps Certification Course - Gangboard
Best Devops Training institute in Chennai

Unknown said...

A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article. I am learning a lot from you.

rpa training in electronic-city | rpa training in btm | rpa training in marathahalli | rpa training in pune

SRI said...

This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me.. 

rpa online training |
rpa course in bangalore |
rpa training in bangalore |
rpa training institute in bangalore

Unknown said...

The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
Best Devops training in sholinganallur
Devops training in velachery
Devops training in annanagar
Devops training in tambaram

Mounika said...

I really like the dear information you offer in your articles. I’m able to bookmark your site and show the kids check out up here generally. Im fairly positive theyre likely to be informed a great deal of new stuff here than anyone
python training in rajajinagar | Python training in bangalore | Python training in usa

simbu said...

Wonderful bloggers like yourself who would positively reply encouraged me to be more open and engaging in commenting.So know it's helpful.

Java training in Chennai | Java training in Annanagar

Java training in Chennai | Java training institute in Chennai | Java course in Chennai

Java training in Chennai | Java training institute in Chennai | Java course in Chennai

Java training in Bangalore | Java training in Electronic city

nivatha said...

Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
Data Science course in kalyan nagar | Data Science Course in Bangalore
Data Science course in OMR | Data Science Course in Chennai
Data Science course in chennai | Best Data Science training in chennai
Data science course in velachery | Data Science course in Chennai
Data science course in jaya nagar | Data Science course in Bangalore
Data Science interview questions and answers

Unknown said...

I am really happy with your blog because your article is very unique and powerful for new reader.
Click here:
selenium training in chennai | selenium course in chennai
selenium training in bangalore | selenium course in bangalore
selenium training in Pune | selenium course in pune | selenium class in pune
selenium training in Pune | selenium course in pune | selenium class in pune
selenium online training | selenium training online | online training on selenium

Unknown said...

Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

rpa training in chennai
rpa training in bangalore
rpa course in bangalore
best rpa training in bangalore
rpa online training

genga g said...

I would like to thank you for your nicely written post, its informative and your writing style encouraged me to read it till end. Thanks
angularjs Training in bangalore

angularjs Training in bangalore

angularjs Training in chennai

automation anywhere online Training

angularjs interview questions and answers

SANDY said...

Howdy, would you mind letting me know which web host you’re utilizing? I’ve loaded your blog in 3 completely different web browsers, and I must say this blog loads a lot quicker than most. Can you suggest a good internet hosting provider at a reasonable price?


Best AWS Training Institute in BTM Layout Bangalore ,AWS Coursesin BTM


Best AWS Training in Marathahalli | AWS Training in Marathahalli

Amazon Web Services Training in Jaya Nagar | Best AWS Training in Jaya Nagar


AWS Training in BTM Layout |Best AWS Training in BTM Layout

sai said...

Really nice experience you have. Thank you for sharing. It will surely be an experience to someone.
python interview questions and answers
python tutorials
python course institute in electronic city

afiah b said...

Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.

Java interview questions and answers

Core Java interview questions and answers| Java interview questions and answers

Java training in Chennai | Java training in Tambaram

Java training in Chennai | Java training in Velachery

Unknown said...

Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
Best Devops Training in pune
excel advanced excel training in bangalore

shalinipriya said...

Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
Data Science Training in Chennai | Data Science Training institute in Chennai
Data Science course in anna nagar
Data Science course in chennai | Data Science Training institute in Chennai | Best Data Science Training in Chennai
Data science course in Bangalore | Data Science Training institute in Bangalore | Best Data Science Training in Bangalore
Data Science course in marathahalli | Data Science training in Bangalore

Unknown said...

hanks for your post. This is excellent information. The list of your blogs is very helpful for those who want to learn, It is amazing!!! You have been helping many application.
best selenium training in chennai | best selenium training institute in chennai selenium training in chennai | best selenium training in chennai | selenium training in Velachery | selenium training in chennai omr | quora selenium training in chennai | selenium testing course fees | java and selenium training in chennai | best selenium training institute in chennai |

Rithi Rawat said...

Thankyou for providing the information, I am looking forward for more number of updates from you thank you
machine learning training in chennai
best training insitute for machine learning
top institutes for machine learning in chennai
Android training in Chennai
PMP training in chennai

Unknown said...

Thanks for your post. This is excellent information. The list of your blogs is very helpful for those who want to learn, It is amazing!!! You have been helping many application.
best selenium training in chennai | best selenium training institute in chennai selenium training in chennai | best selenium training in chennai | selenium training in Velachery | selenium training in chennai omr | quora selenium training in chennai | selenium testing course fees | java and selenium training in chennai | best selenium training institute in chennai | best selenium training center in chennai

Unknown said...

Such a Great Article!! I learned something new from your blog. Amazing stuff. I would like to follow your blog frequently. Keep Rocking!!
Blue Prism training in chennai | Best Blue Prism Training Institute in Chennai

Saro said...

Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
rpa training in bangalore
best rpa training in bangalore
RPA training in bangalore
rpa course in bangalore
rpa training in chennai
rpa online training

UNKNOWN said...

When I initially commented, I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several emails with the same comment. Is there any way you can remove people from that service? Thanks.
Amazon Web Services Training in Pune | Best AWS Training in Pune
AWS Online Training | Online AWS Certification Course - Gangboard
Top 110 AWS Interview Question and Answers | Advanced AWS interview Questions and Answers – AWS jobs

jorick228 said...

Go to the BGAOC website and get instant winnings best internet casino in the world Do not miss your chance.

Mounika said...

Thank you for benefiting from time to focus on this kind of, I feel firmly about it and also really like comprehending far more with this particular subject matter. In case doable, when you get know-how, is it possible to thoughts modernizing your site together with far more details? It’s extremely useful to me 
python interview questions and answers
python tutorials
python course institute in electronic city

ragul ragul said...

Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.
AWS Training in Bangalore
AWS training in sholinganallur
AWS training in Tambaram
AWS training in Velachery

Anonymous said...

Thanks for such a great article here. I was searching for something like this for quite a long time and at last, I’ve found it on your blog. It was definitely interesting for me to read about their market situation nowadays.angularjs best training center in chennai | angularjs training in velachery | angularjs training in chennai | best angularjs training institute in chennai

cynthiawilliams said...

Hearty thanks to you admin, your blog is awesome and helpful. Keep your blog with latest information.
RPA Training in Chennai
Robotics Process Automation Training in Chennai
Blue Prism Training in Chennai
UiPath Training in Chennai
Data Science Course in Chennai
RPA Training in Anna Nagar
RPA Training in Chennai
RPA course in Chennai

gunardi said...

I feel this is among the such a lot vital info for me. And i am satisfied studying your article. However wanna commentary on few general things, The website style is ideal, the articles is truly nice
Tangki Panel
Tangki Fiberglass
Jual Septic Tank

nikitha josh said...

Very interesting post! Thanks for sharing your experience suggestions.
Aviation Courses in Chennai
air hostess academy in Chennai
Airport Management Training in Chennai
airport ground staff training in Chennai
Aviation Academy in Chennai
air hostess training in Chennai
airport management courses in Chennai
ground staff training in Chennai

Sivanandhana Girish said...

Reading your blog left me with some useful info and this was an awesome blog.

Spoken English Classes in Chennai
IELTS Coaching in Chennai
English Speaking Classes in Mumbai
IELTS Classes in Mumbai
IELTS Coaching in Mumbai
IELTS Mumbai
Best IELTS Coaching in Mumbai
IELTS Center in Mumbai

Lucky Patcher said...

youtubers life apk

luckys said...

yesmovies

harish sharma said...

putlocker

htop said...

thanks for sharing this information
best python training in chennai
best python training in sholinganallur
best python training institute in omr
python training in omr
selenium training in chennai
best hadoop training in chennai
best devops training in chennai

chandhran said...

It looks awesome article,keep updating..thank you for providing good information...
Air Hostess Training Institute in Bangalore
bBest Aviation Academy in Bangalore
Airline and Airport Management Courses in Bangalore
Ground Staff Training in Bangalore
Airport Management Courses in Chennai
Ground Staff Training in Chennai
Air Hostess Academy in Chennai
Air Hostess Course in Mumbai
Best Aviation Academy in Chennai
Aviation Training Institutes in Bangalore

tech zone said...

news whatsapp groups

Durai Moorthy said...

Thanks for sharing this wonderful and useful information...
AWS Training in Marathahalli
AWS Training in Bangalore
RPA Training in Kalyan Nagar
Data Science with Python Training Bangalore
AWS Training in Kalyan Nagar
RPA Training in bellandur
Data Science Training in bellandur
Data Science Training in Kalyan Nagar

nisha raj said...

Your post is just outstanding! thanx for such a post,its really going great and great work.
python training in kalyan nagar|python training in marathahalli
selenium training in marathahalli|selenium training in bangalore
devops training in kalyan nagar|devops training in bellandur
phthon training in bangalore

robin said...

Good post!Thank you so much for sharing this lovely article.It was so good to read and useful to upgrade my understanding...
Hadoop training in Bangalore|
Big Data Training in Bangalore|
Big Data Analytics Training in Bangalore|
Hadoop Training in Bellandur|
Hadoop Training in Marathahalli|
Angular JS Training in Bangalore

dhanush kumar said...

The author clearly explains the full view of this topic and it made me more knowledgable in this domain.
salesforce Training in Bangalore
uipath Training in Bangalore
blueprism Training in Bangalore

harish kalyan said...

Really informative blog for all people. Thanks for sharing it.
Spoken English Classes in Chennai
Spoken English Course in Chennai
german classes
Best IELTS Coaching in Chennai
learn Japanese in Chennai
TOEFL Coaching Centres in Chennai
content writing course in chennai
Spoken English Classes in Anna Nagar
Spoken English Classes in Tnagar

Rajesh Anbu said...

A very nice post. Thanks for sharing such a piece of valuable information...
Data Analytics with R Training in Bangalore
Hadoop training center in bangalore
AWS training in bangalore
AWS training in marathahalli
Python training in marathahalli
Hadoop training in marathahalli
Python training in bangalore

Archana said...

I appreciate your blog writing about that specific topics.I am following your blog post regularly to get more updates

salesforce Training in Bangalore
uipath Training in Bangalore
blueprism Training in Bangalore

balamurugan said...

This is good information and really helpful for the people who need information about this.
content writing course in chennai
content writing training in chennai
Blockchain Training in Chennai
Ionic Training in Chennai
IoT Training in Chennai
Xamarin Training in Chennai
Node JS Training in Chennai
German Classes in Anna Nagar
Spoken English Classes in Anna Nagar

Deepthi said...

I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.

aws Training in Bangalore
python Training in Bangalore
hadoop Training in Bangalore
angular js Training in Bangalore
bigdata analytics Training in Bangalore




The India said...

iso 27001 certification services
iso 27001 certification in delhi
ISO 9001 Certification in Noida
iso 22000 certification in Delhi

The India said...

iso certification in noida
iso certification in delhi
ce certification in delhi
iso 14001 certification in delhi
iso 22000 certification cost
iso consultants in noida

The India said...

we have provide the best fridge repair service.
Washing Machine Repair In Faridabad
LG Washing Machine Repair In Faridabad
Videocon Washing Machine Service Centre In Faridabad
IFB Washing Machine service centre in faridabad
Samsung Washing Machine Repair In Faridabad
Washing Machine Repair in Noida
godrej washing machine repair in noida
whirlpool Washing Machine Repair in Noida
IFB washing Machine Repair in Noida
LG Washing Machine Repair in Noida

The India said...

we have provide the best ppc service.
ppc company in gurgaon
website designing company in Gurgaon
PPC company in Noida
seo company in gurgaon
PPC company in Mumbai
PPC company in Chandigarh
Digital Marketing Company

The India said...

Rice Bags Manufacturers
Pouch Manufacturers
fertilizer bag manufacturers
Lyrics with music

Bhanu Ravi said...

I am feeling great to read this.you gave a nice info for us.
please update more.
aws Training in Bangalore
python Training in Bangalore
hadoop Training in Bangalore
angular js Training in Bangalore
bigdata analytics Training in Bangalore

ethiraj raj said...

Good post!Thank you so much for sharing this lovely article.It was so good to read and useful to upgrade my understanding...
aws Training in Bangalore
python Training in Bangalore
hadoop Training in Bangalore
angular js Training in Bangalore
bigdata analytics Training in Bangalore

Tanika Co Valda said...

Great Article. Thank you for sharing! Really an awesome post for every one.
Project Centers in Chennai

JavaScript Training in Chennai

Final Year Project Domains for IT

JavaScript Training in Chennai

raju said...

very nice blogger.......................!!!
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
panama web hosting
syria hosting
services hosting
afghanistan shared web hosting
andorra web hosting
belarus web hosting
brunei darussalam hosting

dras said...

very informative post..!
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
Australia hosting
mexico web hosting
moldova web hosting
albania web hosting
andorra hosting
australia web hosting
denmark web hosting

ammu said...

excellent information....!
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
brunei darussalam web hosting
costa rica web hosting
costa rica web hosting
hong kong web hosting
jordan web hosting
turkey web hosting
gibraltar web hosting

preethi minion said...

very nice.....!
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
italy web hosting
afghanistan hosting
angola hosting
afghanistan web hosting
bahrain web hosting
belize web hosting
india shared web hosting

kani said...

nice..
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
hosting
india hosting
india web hosting
iran web hosting
technology 11 great image sites like imgur hosting
final year project dotnet server hacking what is web hosting
macao web hosting

shree said...

very nice....
inplant training in chennai for it
namibia web hosting
norway web hosting
rwanda web hosting
spain hosting
turkey web hosting
venezuela hosting
vietnam shared web hosting

rajan said...

inplant training in chennai
inplant training in chennai
inplant training in chennai for it.php
chile web hosting
colombia web hosting
croatia web hosting
cyprus web hosting
bahrain web hosting
india web hosting
iran web hosting

shiv said...

nice...................
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
algeeria hosting
angola hostig
shared hosting
bangladesh hosting
botswana hosting
central african republi hosting
shared hosting

hari said...

good
inplant training in chennai
inplant training in chennai
online python internship
online web design
online machine learning internship
online internet of things internship
online cloud computing internship
online Robotics
online penetration testing

shri said...

super post...!
internship in chennai for ece students
internships in chennai for cse students 2019
Inplant training in chennai
internship for eee students
free internship in chennai
eee internship in chennai
internship for ece students in chennai
inplant training in bangalore for cse
inplant training in bangalore
ccna training in chennai


Muthu said...

Very Nice...
internship in chennai for ece students with stipend
internship for mechanical engineering students in chennai
inplant training in chennai
free internship in pune for computer engineering students
internship in chennai for mca
iot internships
internships for cse students in
implant training in chennai
internship for aeronautical engineering students in bangalore
inplant training certificate

sugan said...

very nice post blog.........
r programming training in chennai
internship in bangalore for ece students
inplant training for mechanical engineering students
summer internships in hyderabad for cse students 2019
final year project ideas for information technology
bba internship certificate
internship in bangalore for ece
internship for cse students in hyderabad
summer training for ece students after second year
robotics courses in chennai


sibiselvan said...

it is excellent blogs...!!
inplant training for diploma students
mechanical internship in chennai
civil engineering internship in chennai
internship for b.arch students in chennai
internship for ece students in core companies in chennai
internship in chandigarh for ece
industrial training report for computer science engineering on python
internship for automobile engineering students in chennai
big data training in chennai
ethical hacking internship in chennai

KUTTYMA said...

nice information....

winter internship for engineering students
internship for mca students
inplant training for eee students
inplant training for eee students/
java training in chennai
internships for eee students in hyderabad
ece internship
internship certificate for mechanical engineering students
internship in nagpur for computer engineering students
kaashiv infotech internship
internship for aeronautical engineering students in india 2019

anuarun said...

nice information......
ree internship in bangalore for computer science students
internship for aeronautical engineering
internship for eee students in hyderabad
internship in pune for computer engineering students 2018
kaashiv infotech internship fees
industrial training certificate format for mechanical engineering students
internship report on machine learning with python
internship for biomedical engineering students in chennai
internships in bangalore for cse
internship in coimbatore for ece

raju said...

very nice blogger thanks for sharing......!!!
poland web hosting
russian federation web hosting
slovakia web hosting
spain web hosting
suriname
syria web hosting
united kingdom
united kingdom shared web hosting
zambia web hosting

ammu said...

good information....!!!
chile web hosting
colombia web hosting
croatia web hosting
cyprus web hosting
bahrain web hosting
india web hosting
iran web hosting
kazakhstan web hosting
korea web hosting
moldova web hosting

ammu said...

very good information....!!!
text animation css
animation css background
sliding menu
hover css
css text animation
css loaders
dropdown menu
buttons with css