2
votes

I need a way to add bindings to my VS2015 solution from the command line. In the GUI, the way this is done is File->Source Control->Advanced->Change Source Control. Then I would select the items that are not connected to my TFS server, hit OK, and Save All. The solution then has the items I want added to the bindings.

What I need is a way to do this same operation from the command line if possible? Thanks.

2

2 Answers

4
votes

You can't change source control bindings through a TFS command simply.

However, as a workaroud you can delete the .suo next to the .sln file, and then opened the .sln file in Notepad and deleted this entire section:

GlobalSection(TeamFoundationVersionControl) = preSolution
    SccNumberOfProjects = 2
    SccEnterpriseProvider = {xxxxx}
    SccTeamFoundationServer = http://some-other-guys-tfs-server/
    SccLocalPath0 = .
    SccProjectUniqueName1 = xxDemo\\xxDemo.csproj
    SccProjectName1 = xxDemo
    SccLocalPath1 = xxDemo
EndGlobalSection

Save the .sln in Notepad and then open in Visual Studio.

More details please refer Matt Frear's answer in this question How can I completely remove TFS Bindings


Update

No, you also can't do this through command Line to add bindings.

TF.exe are version control commands. You may have to manually rebind it in VS.

On the File menu, click Source Control, and then click Change Source Control. In Change Source Control dialog box, click Bind.

0
votes

If you use Visual Studio to make changes to the source control bindings, it will change details found in the solution and project files.

If you take a snapshot of these files before making a binding change, make the binding change and then run a difference of the before and after files, that difference will show what changes were made by that process.

With information it should be possible to come up with a way to automate that change using a suitable command line tool.