Recently I wrote a post on the .MySCMServerInfo file, and I mentioned that one of its uses is the IDE integration. In this post, I am going to break this down a little further, and explain the Visual Studio integration with Surround SCM in more detail.  For more information, read the Surround SCM-Visual Studio integration instructions or watch a quick video of the integration in action.
One way to look at this integration is that there are two main pieces:

  • The piece that tells Visual Studio that Surround SCM is the selected source code control provider.
  • The piece that Surround SCM uses to know which branch and repository to bind to.

We already looked at the second piece in my previous post. For this post, I will focus on the first piece of the integration.

How does Visual Studio know that Surround SCM is in control?

When you bind a solution and/or project with any source control tool, references are added to the solution and project file. Every time you open a solution and/or project in Visual Studio, it checks for this reference.

Here is an example of what your solution may look like (I opened the .sln file in Surround SCM using the built-in viewer):

Example Visual Studio solution file with source control bindings

Solution under source control

A similar entry is also added to the project file. Following is an example of a C# project file under source control (also viewed in Surround SCM through the built-in viewer).

Example Visual Studio project file with source control bindings

Project under source control

The main point is that information is embedded in the project and solution regarding the source control provider. Because of this, keep the following in mind:

  • The source control provider is set at the solution/project level. Some users have told me that they have selected the source control provider of their choice, but when they open a solution/project, the source control provider is changed. This is because the solution/project that is being opened has a reference to a different source control provider.
  • Uninstalling a source control provider will not automatically unbind your solution/projects.
  • If you change the provider make sure that the solution and/or project files are checked in. Remember that the references to the provider are part of the file content and must be checked in for those changes to be available to other users or next time you check out or get the solution/project.

How do I remove the binding?

Using the Visual Studio bind/unbind mechanism should remove the binding information. Remember to save and check in the solution/project after this. Sometimes you may find that Visual Studio does not remove the binding information. Not sure if this is because the solution is set to read-only or there is a permission issue. While I cannot officially endorse this method, you could manually edit the solution and project files and remove the reference to the source control provider. You may want to compare it to a solution/project file that is not under source control so you can determine what can be deleted.

How can I change from one provider to another?

This question became a popular one when Surround SCM introduced its “native” plug-in, the “Surround SCM Integration Provider”. The best way I have found to switch a solution/project using the “generic” plug-in (Surround SCM) to the “native” interface (“Surround SCM Integration Provider”) is by following these steps:

  1. Open the solution/project.
  2. Select Tools > Options.
  3. Under Source Control, set the Current source control plug-in: to ‘none’.
  4. Save the solution/project.
  5. Close the solution/project.
  6. Re-open the solution/project. You should not get any message about source control. Also, in the solution explorer, there shouldn’t be any source control icons.
  7. If there aren’t any traces left of the old source control provider, then you can go back to Tools > Options and under Source Control, select the desired source control provider.
  8. Save the solution/project and bind/rebind to source control and check it in.

NOTE: You don’t have to close the solution/project after setting the source code control provider to ‘none’. However, I find it helps me verify that the source control bindings are in fact removed when I open the solution/project back up. Do not try to associate a solution/project with a source control provider until all associations with the prior source control tool have been removed.

Share on Technorati . del.icio.us . Digg . Reddit . Slashdot . Facebook . StumbleUpon

Related posts:

  1. Integrating into Microsoft Visual Studio: the easy way
  2. Automating A .NET Build With MSBuild and Surround SCM
  3. Bridging the Gap: Integrating SCM Tools with IDEs
  4. All about the .MySCMServerInfo file
  5. Surround SCM 2009.1 released
2 Comments

Tags: ,

2 Comments to Visual Studio and Surround SCM

Joe
August 28, 2009

I found that with VS 2005 and the Surround 2008 client, the steps you listed don’t work. Here is what I’ve found that works. (I can’t move to Surround 2009 yet since some developers still have stuff in SVN and the utility to convert it is only for 2008–yes, I said to not bother, but they want “history.”)

I’ve done this about a dozen times now, but I may still have the steps slightly wrong. For VS 2005 and SCM 2008, this is still more accurate than the above.

1. Shut down Visual Studio 2005. You must do this between EVERY conversion else the provider will hang (at least with the 2008 client) when binding.

1a. Make sure Visual Studio is NOT set to open the last solution automatically.

2. Check out entire solution (you actually only need the .sln and .vcproj/.csproj files, but I found it easier to just check the whole thing out.)

3. Open Visual Studio. From Tools|Options change source control provider to “Surround SCM Integration Provider.

3a. For safety, I’be been shutting down VS 2005 again and restarting it.

4. Open the solution.

5. Go to File|Surround SCM|Change Source Control.

6. You may need to Connect (this is really flaky, though constantly shutting VS 2005 down and restarting it seems to mitigate the problem.)

7. Highlight everything and click “Unbind”. Click OK. Save All (probably not needed but after having to kill the devenv.exe environment repeatedly, I got really paranoid.)

7a. Restart VS 2005

8. From Tools|Options change source control provider to “Surround SCM Integration Provider. (This is also inconsistent; sometimes I don’t need to to this. I’ve thrown up my hands as to why.)

9. Go to File|Surround SCM|Bind/Unbind Settings.

10. You’ll probably need to connect.

11. Highlight all items and select Bind. Answer all dialog boxes to the affirmative. Normally it seems that you get a boxes per solution one per project. Sometimes you will get an excessive number of boxes popping up; I just click yes for everything.

12. Check In files.

12a. Sometimes the right files don’t show up in bind/unbind and you have to restart somewhere along these steps.

13. Continue with next solution.

13a. Sometimes you’ll get a dialog that states the project is under source control and to drop dead. When that happens, I shut down Visual Studio. Undo the check out for that project. Delete the project locally, recheck it out and start back up again.

14. Check all remaining files in through Surround Client program.

15. Delete local files and then Get again. (I’ve found that if you don’t do this, version control will not work properly.)

[...] Note that this video assumes your solution does not have any prior bindings. If yours does, you may want to review tips on how to remove source control bindings. [...]

Leave a comment

WP_Big_City

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy this password:

* Type or paste password here:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree

Page optimized by WP Minify WordPress Plugin