This project is read-only.

TFS 2012 - Marking builds as deployed

Oct 4, 2012 at 5:09 AM
Edited Oct 4, 2012 at 10:00 AM

TFS2012 has the concept of deployed builds, this is meant for the whole azure integration but it appears to be possible to mark it as deployed using powershell.

I had to put a try/catch around it because it threw an error even though it was successful.

This puts a row in the "deployed" tab under builds in tfs 2012 web access, it doesn't appear that visual studio supports this concept yet.

It has a redeploy button, but that just queues a new build doesn't actually deploy anything (unless your build sets the build quality)

Add-Type -AssemblyName 'Microsoft.TeamFoundation.Client, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Build.Client, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

$tfs = New-Object -TypeName Microsoft.TeamFoundation.Client.TfsTeamProjectCollection -ArgumentList $TfsServer

try {
 $deployServiceType = [Microsoft.TeamFoundation.Build.Client.DeploymentService]
 $deployService = $tfs.GetService($deployServiceType)
 $deployService.CreateBuildDeployment($Uri, $Uri, $Quality)
catch [Microsoft.TeamFoundation.Build.Client.BuildServerException]
Oct 4, 2012 at 5:18 AM
Edited Oct 4, 2012 at 5:19 AM

Because visual studio doesn't support the deployment concept I also add a custom summary block so you can see the information from VS.


$tfs = New-Object -TypeName Microsoft.TeamFoundation.Client.TfsTeamProjectCollection -ArgumentList $TfsServer$type = [Microsoft.TeamFoundation.Build.Client.IBuildServer]
$buildServer = $tfs.GetService($type)
$buildDetail = $buildServer.GetBuild($Uri);
$buildInformationNode = [Microsoft.TeamFoundation.Build.Client.InformationNodeConverters]::AddCustomSummaryInformation($buildDetail.Information, [System.DateTime]::Now.ToString("G") + " - Tfs Deployer -Released: $Quality",  "Deployment", "Deployment", 75)