Is there a way to track changes to a build definition in TFS 2010? Please go to 'Team Explorer > ProjectName > Builds' in visual studio to see what I am talking about. You need to have access to a TFS server in order to see what I am referring to. Now once you are in the Team Explorer> ProjectName > Builds, you can create a build definition to compile your csproj or sln files on TFS. What I am wondering is, Is there a way to version these build definitions if I do any changes to existing ones or add a new one?
TFS 2010 tracking build definition changes?
1.4k views Asked by Kalyan At
3
There are 3 answers
0
On
I got into the same issue when someone from the team modified the Build Definition, I tried to find all the available option but found none except Xeam Build Definition Extension
which is only supported VS 2012 onward and has some downsides, so finally to get the immediate work around I wrote a small app which returns the Last Modified By
and Last Modified Date
and the complete Build Definition
details which you can compare with previous version to find what got changed.
Imports Microsoft.TeamFoundation.Build.Client
Private Const RootFolder As String = "C:\TFS Utility Reports\"
''' <summary>
''' To Get the Build Definition Details
''' </summary>
''' <param name="teamProjectName"></param>
''' <param name="buildDefinitionName"></param>
''' <returns></returns>
''' <remarks></remarks>
Public Shared Function GetBuildDefinitionDetails(teamProjectName As String, buildDefinitionName As String) As String
Dim buildDefinitionSummary As String = Nothing
Dim buildDefinitionDetails As String = Nothing
Dim reportPath As String = RootFolder & "Build Definitions\" & buildDefinitionName
Dim buildDefinitionDetailsFileName As String = reportPath & "\" & buildDefinitionName & "_" & Date.Now.ToString(CultureInfo.CurrentCulture).Replace("/", String.Empty).Replace(":", String.Empty) & ".txt"
Dim buildService = CType(TfsTeamProjectCollection.GetService(GetType(IBuildServer)), IBuildServer)
Dim buildDefinition As IBuildDefinition = buildService.GetBuildDefinition(teamProjectName, buildDefinitionName)
If buildDefinition IsNot Nothing Then
GetAllBuildDefinitions(teamProjectName)
buildDefinitionSummary = buildDefinition.ToString()
UpdateFile(buildDefinitionSummary, buildDefinitionDetailsFileName, reportPath)
If buildDefinition.Workspace IsNot Nothing Then
buildDefinitionDetails = String.Format(CultureInfo.CurrentCulture, "Last Modified By: {0}, Last Modified Date: {1}",
buildDefinition.Workspace.LastModifiedBy,
buildDefinition.Workspace.LastModifiedDate)
End If
End If
Return buildDefinitionDetails
End Function
''' <summary>
''' Generate Log/Summary/Report
''' </summary>
''' <param name="lineToWrite"></param>
''' <param name="filePath"></param>
''' <param name="folderPath"></param>
''' <remarks></remarks>
Private Shared Sub UpdateFile(ByVal lineToWrite As String, ByVal filePath As String, ByVal folderPath As String)
Dim strFileName As String = String.Empty
lineToWrite = lineToWrite.Trim()
strFileName = filePath
Dim di As IO.DirectoryInfo = New IO.DirectoryInfo(folderPath)
If Not di.Exists Then
di.Create()
End If
Dim streamWriter As New StreamWriter(strFileName, True, System.Text.Encoding.ASCII)
Try
Dim strOutput As String
strOutput = lineToWrite.ToString
streamWriter.WriteLine(strOutput)
Catch ex As Exception
Throw
Finally
streamWriter.Dispose()
End Try
End Sub
0
On
There is a way. There is this tool in the vsgallery:
http://visualstudiogallery.msdn.microsoft.com/ec36f618-d122-48a3-8236-7d9cd19791ee
I used it with tfs2012. I don't know if it works with tfs2010
There is no way to track changes to a build definition. If you have multiple branches / versions you need to build I suggest creating a different build definition.
Some of the properties can be set when you queue the build, so if you want a CI build that does not copy it's output to the drop server, you can have that, but then if you want to deploy a version you can set a drop folder when you queue the build.
In the TFS Power Toys you get a "Clone Build Definition" context menu so you can copy builds easier if you have a lot of settings you want to keep similar.