Connect Visual Studio 2012 to TFS 2012 programmatically Connect Visual Studio 2012 to TFS 2012 programmatically powershell powershell

Connect Visual Studio 2012 to TFS 2012 programmatically


You can use the following code to do this:

# Add servers to vs 2012Add-Type -AssemblyName 'Microsoft.TeamFoundation.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'function Add-Collection([string]$url) {    $uri = New-Object Uri($url)    $ttpc = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($uri)    $projs = [Microsoft.TeamFoundation.Client.RegisteredTfsConnections]::RegisterProjectCollection($ttpc)}Add-Collection -url 'http://mytfsserver:8080/tfs/DefaultCollection'

Note: if you have both VS 2010 and 2012 installed this will only add the registration to 2012.


Maybe this post can help you to find the answers. And otherwise you can try it with command prompt andtf.exe` that can be found in

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE