I am trying to use powershell to use the TFS API to modify some assembly definitions. I am trying to update the definitions to use a specific assembly template. So far, I have managed to set this assembly template as my default, but I cannot figure out how to update the assembly definitions with this new template.
Any help is appreciated. Here's the script I still have:
$TFS2013_Server = "http://localhost:8080/tfs"
$teamProject = "OOTB_Scrum_2013.2"
$serverPath = "$/OOTB_Scrum_2013.2/BuildProcessTemplates/BuildProcessSource/Templates/Custom Template.xaml"
$tfsClientVersion = ", Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
$tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($TFS2013_Server)
$tfs.EnsureAuthenticated()
if (!$tfs.HasAuthenticated)
{
Write-Host "Failed to authenticate to TFS"
exit
}
Write-Host "Connected to Team Foundation Server [" $TFS2013_Server "]"
$versionControl = $tfs.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])
$buildserver = $tfs.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer])
$templates = $buildServer.QueryProcessTemplates($teamProject);
foreach ($pt in $templates)
{
if ($pt.TemplateType -eq "Default")
{
Write-Host "Current Template Type: $($pt.TemplateType)"
$pt.TemplateType = "Custom"
$pt.Save()
Write-Host "New Template Type: $($pt.TemplateType)"
}
}
foreach ($pt in $templates)
{
if ($pt.ServerPath -eq $serverPath)
{
Write-Host "Template found."
Write-Host "Changing type for the template to Default."
$pt.TemplateType = "Default"
$pt.Save()
}
}
foreach ($def in $defs)
{
Write-Host "Current Server Path: $($def.Process.ServerPath)..."
$def.Process.ServerPath = $customBuildTemplate
$def.Save()
Write-Host "New Server Path: $($def.Process.ServerPath)..."
}
source
share