TFS annotate/blame summary report for a project - visual-studio

In Team Foundation Server, I know that you can use the Annotate feature to see who last edited each line in a particular file (equivalent to "Blame" in CVS). What I'd like to do is akin to running Annotate on every file in a project, and get a summary report of all the developers who have edited a file in the project, and how many lines of code they currently "own" in that project.
Aside from systematically running Annotate of each file, I can't see a way to do this. Any ideas that would make this process faster?
PS - I'm doing to this to see how much of a consultant's code still remains in a particular (rather large) project, not to keep tabs on my developers, in case you're worried about my motivation :)

It's easy enough to use the "tf.exe history" command recursively across a directory of files in TFS. This will tell you who changed what files.
However what you're after is a little bit more than this - you want to know if the latest versions of any files have lines written by a particular user.
The Team Foundation Power Tools ship with a command-line version of annotate called "tfpt.exe annotate". This has a /noprompt option to direct the output to the console, but it only outputs the changeset id - not the user name.
You could also use the TFS VersionControl object model to write a tool that does exactly what you need.

If you install the TFS Power tools (at least for VS2005); it's called annotate.
It might be part of VS2008...

You can use TFS Analysis Cube to see generate a code churn report, which I believe is something you would like.

Annotate is now part of Visual Studio (I think it was introduced in VS 2010).
Docs

I'm writing an answer to an 8 year old question :). Its not really a full answer, but a suggestion to look into excel reports for TFS.
TFS2013 / 2015 on prem has something has an excel report that can be used to visualize Code Churn.
In VS open team explorer then select "Documents" then explode "Excel Reports". I believe Code Churn report has something like discussed. The report is made by some default project template so I think tfs2013 on prem just creates it.
Code Churn Excel Report VS2015
https://msdn.microsoft.com/en-us/library/dd695782.aspx

I had very similar requirement to get details of particular attribute in a file e.g. who added, when, related work items etc.; Following GitHub project is having implementation to get required details and required minimal changes to work with multiple files or project -
SonarQube SCM TFVC plugin
It requires analysis to be executed from Windows machines with the Team Foundation Server Object Model installed (download for TFS 2013).
This blog post is also having good explaination and sample application -
TFS SDK: Connecting to TFS 2010 & TFS 2012 Programmatically

Related

What is a good learning resource for TFS and how to use TFS with Visual Studio?

What is a good learning resource for TFS and how to use TFS with Visual Studio?
Specifically, I want to know two things.
Exactly what are the step-by-steps procedures of checking in code. I know that I am required to do a code review. So, after the code review is done by a peer, I understand that this is not enough and the original developer has to click to do something to submit the code into the TFS system. I mean, I want to know precisely what buttons to click on.
I also want to know how to use Visual Studio to look up the actual version. How do I determine the details of what is already checked in?
There are many blogs videos in google. If you want a full detail resource, suggest you directly take a look at our official doc here -- Azure DevOps Server Documentation
A suggested learn order for your reference:
Installation (you could skip this if your company already done this)--
Code -- Build&Release -- Packages-- Test-- Work-- Analysis-- Admin
Tool
TFS supports two types of version control: Git and Team Foundation Version Control (TFVC). One centralized and one distributed. As for which version control system should you use, you could take a look at this thread: Choosing the right version control for your project
For your case, you could easy check the history in server side. It's called changeset in TFVC and commit in Git.
For example, when you check in your changes, they are stored on the server as a changeset. Changesets contain the history of each item in version control.
You can view a changeset to see what the exact file changes were, discover the owner's comments, find linked work items, and see if any policy warnings were triggered.
The same as Git, actually you could find the answer for both question 1&2 in Code part. Hope it helps.

tfs2013 share project across many projects

I have a few (3) core projects I want to share across many solutions (12+).
So, say I have 12 websites and they use some shared back end core code (in this case I'm not talking about shared js, css or views - I'm talking about business objects, entity stuff, etc.).
I need to be able to identify which site has which version of the shared code in dev, test, prod, etc. so a developer can get the website code and get the right version of the shared code to develop or patch the website.
And then the MS build server needs to know which version of the shared code to get for the deployment.
To solve this, I'm seeing people branch that core code - which seems absurd to do 12+ times. (I do expect to branch the core code sometimes for things like hot fixes and long running projects.)
I'm also seeing people copy DLLs of the core code and check those in.
I would think I would list the dependencies for my solutions based on TFS label names somewhere so developers can easily get the apps running with the right code and given a tfs label the build server can get the code for the website and the proper version of the core code. I'm using TFS & VS 2013 at the moment too, so there's that.
So, is there a way to do this that's straightforward, supportable/scale-able and intuitive? Thanks - Peter
Labels in TFS is very limited. For example once the label created you couldn't change and update it. If one of your core projects updated, did you need to create a new label for it. If you did and use the new label for one of your solution. However you found there are some bugs in this update, you need a newer update of your core project to fix the bug. Then a newer label created, you need to manually maintain the dependencies which seems not to be an easy job.
Moreover how to list the dependencies for your solutions based on TFS label names? TFS don't have this built-in option, seems the only way is store it in a txt or someother files and check in the source control. Every time the developer open a website application need to check it first and get label from server to their workspace and work on it.
Usually the purpose of sharing code between projects is reducing maintenance. There’s two main code sharing paths: source and binary. The difference between them you could take a look at this blog: Code Sharing in Team Foundation Server
Sharing code between products is a primary cause of quality erosion and elevated bug counts. I would recommend you to build separately and sharing binary output through NuGet which use preferable.
Also take a look below similar questions:
Sharing code between solutions in TFS
TFS 2010 Branch Across Team Projects - Best Practices

how can i migrate my current tfs 2013 custom work items to 2015 visual studio cloud?

I currently use TFS 2013 with custom work items for bugs, change request, requirements and features. I am wondering if I can migrate them to visual studio cloud 2015? is there a tool within VS or 3rd party that can do this?
If you are meaning the vsts. Possibly duplicate with this question: How to migrate work items from TFS to VS Team Services (VS Online) . There has been perfect answer from jessehouwing, suggest use one of below three ways as he suggested:
Use Excel for import/export - Will work for most work items, you loose attachments and work item links other than parent/child. The
trick is to extract from one Project Collection then copy all fields,
except the ID to an Excel sheet bound to the target project
collection. You will need to fix all Identity fields (works best when
users have the exact same display name on premise as in VSTS) and
you'll have to import once with state new and then past the current
state/reason over the just imported values and sync again. Test
Cases, Plans, Suites and Shared Steps will not be imported with their
relations in tact. The approach would be very similar to this
one.
Use the TFS Integration Tools - Will work for most work item types, though it will loose custom kanban states and tags. Test
cases, Shared steps and their relations will not be imported. This
option will allow you to import import work items and source code
with their relationships in tact.
Use a 3rd party solution - Out of the available options currently OpsHub offers the most complete solution. For test case and
source control link migration you're looking at the commercial
edition, which comes at a steep price. It still has a long list of
known issues and last time I tried it, I ran into numerous
issues which required their support to resolve them. PS: You can aslo try the tool as Dave suggested in the comment: VSTS Sync Migration Tools

Mass migration of Crystal Reports from v10 to Visual Studio 2010

I have been tasked with reviewing "SAP Crystal Reports for Visual Studio 2010" and the "SAP Crystal Reports 2011" standalone as potential upgrade paths from Crystal Reports v10.
I've installed the extension to Visual Studio 2010 (and went through the common troubles of updating the runtime to get the viewer working) and can open report files and save them. Consequently, I get the "this report was saved in a previous version of CR, saving will upgrade the report file format" dialog. I've tested on a couple of reports and the conversion goes ahead smoothly and the resultant file remains compatible with our server software.
My problem is I have over 1,500 reports. I'd like to avoid opening each one in turn and saving/converting individually. Is there a way to convert all the report files in one fell swoop? Some means of scripting Visual Studio to do it, maybe?
Notes:
I've added every report file to a project and attempted to Save All... no dice.
I must convert every single report now. It's not an option to just convert those that need changes when they need changes.
My work network access is locked down pretty tight. The bureaucratic process to get any utilities or tools installed on my machine is INTENSE and must be justified.
We don't use any features of CR standalone that aren't shipped with VS.
P.S. It's worth re-iterating that I'm also reviewing CR2011. I'll need to do the same thing with the standalone designer too.
Why not use Windows PowerShell? I've written a PowerShell wrapper around the Crystal Reports SDK named PsCrystal. My goal is to make it easier to script the mundane tasks that I encounter each day.
You should be able to adapt the (sole) example to suit your needs. I will add more examples in the near future. Feel free to help the project, if you want.
Check if this tool will work for you:
http://www.r-tag.com/Pages/CRDataSource.aspx
It is actually replacing the connection, but will upgrade the reports too.
Thanks to Craig and Lan for their input (you get an upvote), but Ryan addressed my problem within the comments of my question (and even did so after I gave him sass!).
For those with broken scroll-wheels and/or extraordinarily short screens:
For VS2010, you could easily create a simple program to open each .rpt
file in a directory and then re-save it (The web is full of examples
in the language of your choice). Doing this in CR2011 is a little
trickier... I'd try a script in something like AutoIT.
Thanks, Ryan, for reminding me that I'm working with an API. Not just a dev environment.

Unexplained results with VS2008 "Get everything..." option

We've only recently begun using TFS (2008) with Visual Studio (2008). A couple of developers discovered the "Get everything when a solution or project is opened" option in VS and decided it was a good idea--and it would seem to be.
However, we've been getting some curious results when opening some solutions. The solutions in question contain several projects of mixed types--mostly class libraries and web apps. The curious part is the list of files in the "Get" dialog box that comes up.
Here's what I've found out so far about the files in the list:
The list is incomplete; not every controlled file in the solution is listed.
The version in the workspace matches the version in source control.
They are not missing from the workspace.
There are files from each of the projects in the solution; though, not every file in each project is included.
The list of files is the same for three seperate developers on three seperate machines.
Running a tf get from a command line does not yeild the same results.
Any insight into this would be greatly appreciated. As I mentioned, this option seems like a good idea, but we're a bit hesitant to rely on it when the results are unexpected.
Thanks.
I know that any files that are not in any project will not be pulled down by TFS when you go to get a latest at the solution level. My guess is that is part of your mixed/unexpected results.
I personally do not have that option checked. I always pull everything down from source control first thing. Whenever I check in source code, I also pull down everything again, compile it and run it first. That way I do not introduce any issues into TFS.
I would make sure that everyone on your development team is using the same general settings for TFS source control. I always have it prompt for check out (saving/editing) and get latest version of item on check out.
Have you applied the latest SP for TFS 2008 (SP1 last I remember). And SP1 on each developer's machine as well?

Resources