Binding and rebinding solutions in Visual Studio

A collection of information about Vault, including solutions to common problems.

Moderator: SourceGear


Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Tue May 08, 2012 1:17 pm
Rebinding Methods

Note: This article applies both to Vault Standard and Vault Professional. Users can avoid merges and accidental overwrites by checking in their code, and then all performing a Get Latest before starting.

Project Layout and its effect on rebinding

Vault Visual Studio Enhanced Client (VS 2005 Compatible Client)
Vault Classic Client (VS 2003 Compatible Client)

More on Binding

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Tue May 08, 2012 1:21 pm
Solution/Project Layout and its effect on rebinding

a. Location of the .sln in relation to the projects.

    i. Visual Studio allows the .sln file to be in a completely unrelated folder on disk. When VS opens a solution that was added to Vault from a different client, it often makes the assumption that the .sln file is close by, which can cause the layout to not match the original user’s machine. This can cause the bindings to Vault to not work.

    ii. The layout that is the easiest to work with has a pyramid shape with the .sln at the top. The layout looks like:
    --Top Level Solution Folder
    …………|--.sln file
    …………|--.Project Folder 1
    ……………………|--Project files
    …………|--.Project Folder 2 (if more than one sub-project)
    ……………………|--Project files

    iii. What the previous layout allows the user to do is add the entire solution to Vault and for any other users to perform an Open from Vault or Open from Source Control and retrieve an entire bound solution/project with one command. Different layouts can sometimes require that solution/projects be manually bound through the Change Bindings or Change Source Control dialogs.

b. No solution file.

    i. The Vault Classic Client can have websites without the .sln file added to source control or the .sln file can be added. See section V for information on how to bind without the .sln file, and see section VI for information on how to bind with the .sln file.

c. For more information relating to the Vault Visual Studio Enhanced Client and the errors that may come up with some solution/project layouts, see this KB article: viewtopic.php?t=9672.

RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Tue May 08, 2012 1:42 pm
Automatic rebinding after handing off from VSS

a. This feature can only be found in the Vault admin web page, which is reached by going to http://<your Vault server information>/vaultservice/admin.

b. As soon as the handoff is finished, additional options will be presented, one of which is to rebind. Click “Rebind Visual Studio project and solutions in this repository.

fig1.JPG
fig1.JPG (20.48 KiB) Viewed 11404 times


c. Another location where one can choose the option to automatic rebind is under the Source Control Repositories menu on the left-side of the admin web page. Expand the repository name, and click on Rebind Projects.

fig2.JPG
fig2.JPG (12.91 KiB) Viewed 11404 times


d. Select the folder level you want to rebind at. You may attempt to rebind everything by selecting $.

fig3.JPG
fig3.JPG (40.85 KiB) Viewed 11404 times


e. Enter the URL for your Vault server.

fig4.JPG
fig4.JPG (18.16 KiB) Viewed 11404 times


f. You will be presented with a list of files that can be bound. Select the check box next to the items to rebind.

fig5.JPG
fig5.JPG (72.9 KiB) Viewed 11404 times


g. If you receive an error on some of the items, those particular solution/projects will need to be bound through Visual Studio.

fig6.JPG
fig6.JPG (54.74 KiB) Viewed 11404 times


h. If the rebind is successful, you will receive a dialog saying the commit was successful.

fig7.JPG
fig7.JPG (17.07 KiB) Viewed 11404 times


RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Wed May 09, 2012 10:40 am
Vault Visual Studio Enhanced Client (VS 2005 Compatible Client)

I. Previously bound to a different provider, and other provider is not present.

a. Open the solution in Visual Studio. You will receive a few errors about the previous source control provider. Click Ok on these error boxes.
fig1.JPG
fig1.JPG (15.05 KiB) Viewed 11389 times


b. Click Ok.
fig2.JPG
fig2.JPG (14.64 KiB) Viewed 11389 times


c. Choose the option to Permanently Remove Binding.
fig3.JPG
fig3.JPG (20.52 KiB) Viewed 11389 times


d. After the bindings are removed, there should be no icons next to the files of the solution/project in the Solution Explorer.
fig4.JPG
fig4.JPG (11.01 KiB) Viewed 11389 times


e. Go to Tools - Options - Source Control - Plug-in Selection.
fig5JPG.JPG
fig5JPG.JPG (28.85 KiB) Viewed 11389 times


f. Select the SourceGear Vault Visual Studio Enhanced Client and click OK.

g. Go to File – Vault Source Control – Change Bindings.

NOTE: In some cases it may be possible to select all lines and click Bind. That is only possible if there is some root folder from which all parts of the solution/project can be reached. This isn’t included in the instructions below. The end result in this case would look like:
fig6.JPG
fig6.JPG (35.77 KiB) Viewed 11389 times


h. Select one line that is not the .sln file and click Bind.
fig7.JPG
fig7.JPG (16.86 KiB) Viewed 11389 times


i. You may have to first select the repository to bind to and login to Vault.

j. When the binding window opens, if a path to the location in Vault isn’t present, click the browse button (a button with an ellipse) to explore the Vault tree.
fig8.JPG
fig8.JPG (11.89 KiB) Viewed 11389 times


k. Select the folder that holds the project you selected and click OK, and then click Bind.
fig9.JPG
fig9.JPG (22.75 KiB) Viewed 11389 times


l. Check that the status for that line is Valid.

m. Repeat on each line, but bind the .sln file last. When all are Valid, click OK.
fig10.JPG
fig10.JPG (16.64 KiB) Viewed 11389 times


n. You will receive a warning about changing the bindings. Choose the option to “Use these bindings anyway.
fig11.JPG
fig11.JPG (16.75 KiB) Viewed 11389 times


o. You may be prompted to check out the changed files. Click Yes.
fig12.JPG
fig12.JPG (11.97 KiB) Viewed 11389 times


p. Check in the changes to the .sln and project files.

q. All other users who work on that solution/project need to use the same client. They now need to set their Source Control to the SourceGear Vault Visual Studio Enhanced Client and perform an Open From Vault or to rebind in the same manner you just employed.

RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Wed May 09, 2012 11:16 am
Vault Visual Studio Enhanced Client (VS 2005 Compatible Client)

II. Bound by a previous user

a. Go to VS Tools – Options – Source Control – Plug-in Selection and set it to use the SourceGear Vault Professional Visual Studio Enhanced Client.

b. In VS go to File – Vault Source Control - Open from Vault.
FIG1.JPG
FIG1.JPG (24.06 KiB) Viewed 11387 times


c. You may be asked to log in.

d. Select the repository that the solution belongs to.

e. Browse to the .sln file, select it, and click OK.
FIG2.JPG
FIG2.JPG (50.78 KiB) Viewed 11387 times


f. If a working folder wasn’t already set, you will be prompted for a working folder for the solution.

g. In a few moments you will have an open solution/project with icons (locks or green circles with checks) next to the file names.
FIG3.JPG
FIG3.JPG (10.06 KiB) Viewed 11387 times



RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Wed May 09, 2012 3:55 pm
Vault Visual Studio Enhanced Client (VS 2005 Compatible Client)

III. No previous bindings

a. In this case, the solution/project was not added to Vault using Visual Studio. The code was added using the Vault GUI client and now needs to be bound to Visual Studio.

b. Set a working folder in Vault. If the solution/project is already on disk, make sure the working folder points to the same location on disk so that all the subfolders line up.
Fig1.JPG
Fig1.JPG (14.88 KiB) Viewed 11380 times


c. Perform a Get Latest on the solution/project to get it to disk. If the project is already there, still perform the Get so that Vault can determine a status on the files and set the file properties.

d. Open the solution in Visual Studio.

e. Go to VS Tools – Options – Source Control – Plug-in Selection and set it to use the SourceGear Vault Professional Visual Studio Enhanced Client. Click Ok.

f. Follow the same binding instructions as in section I, g – q.


RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Wed May 09, 2012 4:19 pm
Vault Visual Studio Enhanced Client (VS 2005 Compatible Client)

IV. Switching from the Vault Classic Client

a. In this case, the solution/project is in Vault and bound to the Vault Classic Client in Visual Studio.

b. One option is to use the auto rebinding function found in the Vault admin web page and described earlier in this document.

c. To change the bindings manually, open the project first as is.

d. In Visual Studio, go to File – Source Control – Change Source Control.

e. Select all line in the Change Source Control window and select Unbind.

f. You may receive a warning. Click unbind on the warning window.
FIG1.JPG
FIG1.JPG (12.55 KiB) Viewed 11380 times


g. Click Ok to apply the binding removal.

h. Go to VS Tools – Options – Source Control – Plug-in Selection and set it to use the SourceGear Vault Professional Visual Studio Enhanced Client. Click Ok.

i. Follow the same binding instructions as in section I, g – q.


RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Thu May 10, 2012 2:00 pm
Classic Client (VS 2003 Compatible Client)

I. Solution/project in Vault already, and previously bound to a different provider, and the solution/project is on the users hard drive.

a. Open the solution/project on disk. (If the solution is not on disk, open the Vault GUI client, set a working folder, and perform a Get of the entire solution and it’s projects to disk.)

b. If the previous source control provider is not available, then errors may come up. Click OK through errors.

c. A window may open that gives the option to Permanently Remove Bindings. Choose that option.
FIG1.JPG
FIG1.JPG (24.31 KiB) Viewed 11367 times


d. Once the solution/project is fully open, go to File – Source Control – Change Source Control.

e. If the project is bound, select all lines, click Unbind, and click OK.

f. If the project is showing as not bound, then click OK.

g. Go to VS Tools – Options – Source Control – Plug-in Selection and change the provider to the SourceGear Vault Classic Client. Click OK.

h. Return to File – Source Control – Change Source Control.

i. In the window that opens, select one line that represents a project but not the .sln file. Click Bind.

NOTE: In some cases it may be possible to select all lines and click Bind. That is only possible if there is some root folder from which all parts of the solution/project can be reached. This isn’t included in the instructions below.

j. Login to Vault.

k. Select the folder that holds the project and click OK.

l. You will be returned to the list of projects. Select each project and bind it.

m. Once all projects are bound, select the line for the .sln file and bind it.

n. Click OK.

o. The binding will write to several files in the project. Check in the pending changes so that the binding changes are now available for other users in Vault.
p. After this, other users only need to go to File – Source Control – Open from Source Control to get the project with the new bindings. Or they can bind with the same process here.

RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Thu May 10, 2012 3:21 pm
Classic Client (VS 2003 Compatible Client)

II. Solution/project in Vault already, and previously bound by some other user to the Vault Classic Client, but not present on your hard drive.

a. If the layout is in a pyramid shape discussed in the section on project layout:

    i. Open Visual Studio.

    ii. Go to VS Tools - Options - Source Control - Plug-in Selection.

    iii. Select the SourceGear Vault Classic Client and click OK.

    iv. Go to File – Source Control – Open from Source Control.

    v. Login if prompted and select the repository.

    vi. In the “Create local project from Vault” window, set the working folder and select the folder that holds the .sln file. Click OK.
    FIG1.JPG
    FIG1.JPG (32.21 KiB) Viewed 11366 times


    vii. You may be prompted to allow the creation of the folder structure for the project. Click Yes.
    FIG2.JPG
    FIG2.JPG (12.05 KiB) Viewed 11366 times


    viii. The project will open and have locks by the objects.
    FIG3.JPG
    FIG3.JPG (10.34 KiB) Viewed 11366 times


RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Thu May 10, 2012 3:25 pm
Classic Client (VS 2003 Compatible Client)

III. Solution/project in Vault already, but has no bindings to any SCC provider.

a. Open the Vault GUI client, set a working folder for the solution/project, and perform a Get Latest to pull the files to a disk location.

b. Open the solution/project in Visual Studio.

c. Go to File – Source Control – Change Source Control.

d. Follow instructions for binding to the Vault Classic Client in section I.i - p.

RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Fri May 11, 2012 8:52 am
Classic Client (VS 2003 Compatible Client)

IV. Switching a solution/project from being bound by the Vault Enhanced Client to the Vault Classic Client.

a. Open Visual Studio and the solution/project using either the recent projects link, using the Visual Studio Open function, or by double-clicking the .sln file in Windows Explorer.

b. Go to File – Vault Source Control – Change Bindings.

c. Select all the lines in the Change Source Control window and click Unbind.

d. Click OK.

e. Go to Tools – Options – Source Control – Plug-in Selection and change the provider to the SourceGear Vault Classic Client, and click OK.

f. Perform the binding instructions found in section I. instructions i - p.

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Mon May 14, 2012 4:08 pm
Classic Client (VS 2003 Compatible Client)

V. Websites without controlled solution files.

a. Only the Vault Classic Client has the option to work with websites without the .sln file being under source control.

b. If you are adding a website without the .sln file to Vault:
    i. Go to File – Source Control – Add website to source control.
c. If you are opening a website from Vault that doesn’t have a controlled .sln file:
    i. Go to File – Open – Website.

    ii. Click on the Source Control button on the left side.
    Fig1.JPG
    Fig1.JPG (19.23 KiB) Viewed 11320 times


    iii. Click the Select Source Control Project button.

    iv. You will be prompted to login to Vault, choose a repository, and select the Vault folder that holds the website.

    v. You may be prompted to create a directory, and you will have the option to either edit or review the website settings before the project opens.
    Fig2.JPG
    Fig2.JPG (28.8 KiB) Viewed 11320 times


    vi. Click Open.
d. Changing bindings for websites is the same as for other projects, except that a website without the .sln file in Vault cannot use the SourceGear Vault Enhanced Client.

e. If your website does have a .sln file that will be placed into Vault, then it will be treated the same as other projects with solution files.

RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Mon May 14, 2012 4:11 pm
Classic Client (VS 2003 Compatible Client)

VI. Binding a website with a controlled .sln file.

a. Every type of project in Visual Studio from VS 2005 forward will have a .sln file. Typically, websites will place the .sln file in %username%\Documents\Visual Studio <year>\Projects\<website name>. (<year> indicates here the VS version such as Visual Studio 2005 or Visual Studio 2010).

b. If a user wishes to place the .sln into Vault, then treat the solution/projects the same as other projects with solution files.

RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Mon May 14, 2012 4:24 pm
Rebinding to a different server.
(An alternative option is shown at the end of this post.)

a. Open the solution in Visual Studio using either the Recent Projects link or by double-clicking the .sln file in Windows Explorer.

b. When the login windows comes up, click Work Offline. No problems will be caused if you login if the server is present, but if the old server is gone, then any attempts at logging in will fail and cause errors.
Fig1.JPG
Fig1.JPG (19.82 KiB) Viewed 11317 times


c. Unbind the solution and projects using one of the following methods.

    i. Go to File – Source Control – Change Source Control. Select all the lines in the window that opens and click Unbind. Click OK.

    ii. Go to File – Vault Source Control – Change Bindings. Select all the lines in the window that opens and click Unbind. Click OK.
d. Close the solution and Visual Studio. Save any changes if prompted to save changes. Closing and reopening Visual Studio allows a different server to be chosen for changing the bindings. Without this step, Visual Studio will try to bind back to the same server as before.

e. Open Visual Studio and the solution/projects using either the Recent Projects link or double-clicking the solution file in Windows Explorer.

f. If you wish to bind to the Vault Classic Client on the new server, follow instructions in section I. instructions i - p.

g. If you wish to bind to the Vault Enhanced Client on the new server, follow instructions in section I, g – q.


RETURN TO TOC

Alternative

It's possible in some cases to just replace the old server name with the new server name in the solution and project files.

    1) Check out the .sln files and any project files (.csproj, .vbproj, etc.).

    2) Search for the old server name and replace it with the new server name. For example, if your server was vault.myoldserver.com, you would replace that with newervault.mynewserver.com in the URLs listed.

    3) Check in the edited .sln and project files.

    4) Have users use their Vault GUI clients to perform a Get on the edited .sln and project files.

    5) Users can now open VS and continue working.


RETURN TO TOC

Posts: 7313
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
PostPosted: Mon Sep 10, 2012 3:14 pm
Manually Remove Vault Enhanced Client Bindings.

    1) Open the .sln file in notepad.

    2) Look for a global section similar to the following:
    GlobalSection(VaultVsipSolution-v1) = preSolution
    VaultHost = http://<your Vault server>/VaultService
    VaultRepositoryID = 2
    VaultRepositoryGUID = 09be…(some long GUID) …1f58
    ProjectCount = 1
    ProjectRelativeDiskPath1 = WindowsFormsApplication1\WindowsFormsApplication1.csproj
    EndGlobalSection

    3) Remove that section from GlobalSection to EndGlobalSection. Make sure you don’t remove other GlobalSections that may come after this section.

    4) Open any project files that are part of the solution in notepad. They may end with .csproj, .vbproj, or something similar.

    5) There are 4 lines in the project files that list SCC bindings. Remove those 4 lines.

    <SccProjectName>WindowsFormsApplication1</SccProjectName> <SccLocalPath>2~09be…(some long GUID) …2681f58</SccLocalPath> <SccAuxPath>http:// <your Vault server>//VaultService</SccAuxPath> <SccProvider>SourceGear Vault Visual Studio 2005 Client:{7BE…some long GUID …134B30}</SccProvider>

    6) Once the .sln and project files have been changed and saved, you can open the solution from disk and it will open without source control settings. If you want these changes placed into Vault, then open the Vault GUI client and check in the .sln and project files. If the files have a Renegade status, then you will need to check them out with the Vault client first and then check them in.

Return to Knowledge Base (Vault)

Who is online

Users browsing this forum: No registered users and 2 guests

cron