How can the current TFS sprint/iteration number be included in the build number for a TFS 2012 build template?
i.e. If current iteration is Release 1/Sprint 5, would like to have build number be: 1.5.(rev number).
Currently using ReleaseDefaultTemplate.11.1.xaml (Release Management for Visual Studio 2013 build process template).
Very cool!
You would need to run something prior to the "BuildNumber" task in the workflow (that's the first activity) to go retrieve and build that data. There is no OOB help, and i would suggest that you use PowerShell to retrieve the data and set the builddetails. I say PowerShell as this will be able to be reused when you move to TFS 2015 and the new build system.
An alternative that i have used is to set the build number to "mybuild_1.5.{build}.{revission}" and use PowerShell to parse out that number. This is easy as you can use existing PowerShell to achieve it. It does however require that at the end of the sprint that you go increment the number. Not ideal, but only seconds to achieve.
https://github.com/tfsbuildextensions/CustomActivities/blob/master/Source/Scripts/ApplyVersionToAssemblies.ps1
Related
Visual Studio 2013 has a feature that allows for performing a data compare between your SSDT project and a target database.
According to another post here on SO, there are certain requirements with regards to performing such a compare.
Those requirements taken into consideration, I want to do something like this as a part of our build and deployment process:
Publish any DB schema changes to the target database(s) to make sure that source and target have exactly the same tables, columns, SP's, etc. to comply with the requirements mentioned in the link above
Run a data compare and generate an update script, or publish any changes in the source DB directly to the target DB
Currently, I have a script which takes care of bullet no. 1 by doing a schema compare, using a DACPAC, via sqlpackage.exe. It does not look like it is possible to perform a data compare using sqlpackage, though, and I have not found any other alternatives yet. In VS 2010 it was possible to run a data compare via the command window, but I have not seen any documentation regarding this in VS 2013...
Thus, my question is if there exists an API and/or other tools that allows for a data compare to be run programmatically through e.g. a Powershell script.
It appears you are correct, for schema diff there is command line support as long as SSDT is installed on disk (more details here), but there is no programmatic interface yet for data compare and update.
I am new to a company which uses TFS as a source manager. Currently when we make a new branch we create a copy of an old Build, then manually go in and edit all the workspace file paths and process definitions to reflect the new version(ie: if it was a copy of a 1.2.0 build, we go in and manually replace all the 1.2.0's with 1.3.0's)
Since we have ~70 folders and ~150 required processes to build, this gets rather tiring, time comsuming, and is error prone. I've read that there is an API for TFS you can use- Is there a custom script I could write to replace all the old version #'s with the new ones?
Also, under 'Workspace' its not too bad because you can copy it into notepad and do a 'ctrl+h' to replace it- it's really the processes that are killing it.
-Thank you, Kurtis
I highly suggest you look at installing TFS Power tools. It has a clone feature for build definitions that makes this very easy to do. I don't know why it isn't built in, but the power tools are really great.
Power tools for TFS 2010 -
http://visualstudiogallery.msdn.microsoft.com/c255a1e4-04ba-4f68-8f4e-cd473d6b971f
For 2010 you might need this one instead, but you should check both out - http://visualstudiogallery.msdn.microsoft.com/16bafc63-0f20-4cc3-8b67-4e25d150102c
I'm trying to build a publish script that doesn't use VS2010 -- I want it to be automated and in powershell (may use Psake soon). The biggest issue that I run into is that a project that will build and publish fine in VS2010 will either not build or not publish via the msbuild command. The closest I can get is (anonymized code):
msbuild /p:OutDir=c:\temp\publish\staging\myProj\myProj_1481\;Configuration=Debug;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False C:\TEMP\export\myProj\1481\src\myProj.com\myProj.csproj
That one is failing for a Could not find file error in one of the DLLs. Naturally it publishes fine from VS2010. Is there some sort of recursion that I need to do? I'm burning up quite a bit of time on this one particular portion of my script -- the one part I have the least control over.
Requirements:
if the proj will build in VS2010 I shouldn't need to modify the csproj file -- I don't want to hand this script off to someone else and have them stick in "fix your csproj" land for hours per project
have to be able to script it entirely at the command line
hopefully no additional installs needed
Related:
Trying to Build and Publish Asp.net website from command line using aspnet_compiler (old)
_CopyWebApplication with web.config transformations (didn't fix my issue)
Using TFS and Visual Studio 2010, is it possible to get a report of the number of lines of code each team member has written?
I know the Annotate feature allows you to see who is responsible for all of the code within a file, but is there anything that would aggregate this into a total number for each team member??
I wrote a powershell script that requires TFS Power Tools and takes an extremely long time to run, and is really kind of embarrassing code because it's the first thing I've written in powershell. You're welcome to grab it from my bitbucket repository. If you fix or improve anything, please send me an update.
All it does recursively go through (almost all) the files from the current path, and run annotate on each one, grab the changeset # from each line and increment a dictionary entry for that changeset, then loops through each changeset and finds the responsible user and adds that changeset's lines into that user's dictionary entry. It spits it out in a html table, so run it like LineCount.ps1 > LineCount.html
You may be able to use http://msdn.microsoft.com/en-us/library/ms244698%28v=VS.90%29.aspx if you're running a version of SQL capable of using data cubes
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