Pages

Wednesday, September 19, 2012

Using VSS 2005 with Visual Studio 2012

It's easy to integrate Visual SourceSafe into Visual Studio 2012

Visual Studio 2012, launched on 15th Aug 2012, is a terrific IDE. While most of its documentation includes references to using Team Foundation Server (TFS) integration as the source control, it remains very easy to use VSS 2005 instead, by using the VSS plug-in to get a seamless experience.

This is extremely useful to those of us who have, for years, been using Visual SourceSafe 2005 with Visual Studio 2010, are happy to be in the comfort zone, and find it simpler to stick to VSS until absolutely forced to move.

Steps to follow:

A. Select VSS as the plug-in:

  1. Make sure the VSS 2005 client is installed on your machine. If you have been using it with your VS2010 installation, then it's already there.
  2. In VS2012, go to TOOLS > Options
  3. The Options window will come up. In this window, expand "Source Control" on the left pane, and click on "Plug-in Selection". You should see the following choices in the dropdown (which may vary depending on what other source control plugins you have available on your machine): None, Visual Studio Team Foundation Server, Microsoft Visual SourceSafe, and Microsoft Visual SourceSafe (Internet)
  4. Select Microsoft Visual SourceSafe from the dropdown
  5. (Do not click the OK button at this stage)

B. Next, adjust the VSS environment settings, if necessary:

  1. Under Source Control in the left pane, click on "Environment"
  2. Make sure that "Visual SourceSafe" shows in the dropdown selection in the right pane, then look through all the settings to make sure they are as desired. For most cases, the defaults should be fine.
  3. (Do not click OK even now!)

C. Finally, make sure the VSS-specific settings are correct:

  1. Under Source Control in the left pane, click on "Plug-in Settings"
  2. Make sure the VSS login id is correct
  3. Click on the "Advanced..." button, and examine each tab of the resulting "SourceSafe Options" window to make sure everything is as expected. Click OK in that window once you're done.
  4. Click OK in the "Options" window, to save your selection.
Specifying VSS 2005 as your source control for VS 2012 is now complete. You should now be able to right-click on any solution in the Solution Explorer, and select "Add Solution to Source Control". This would display the VSS log-on window, and enable you to take it from there.

Once your solution is in VSS, with the correct settings, you'll find most activities to be highly simplified: Starting to edit a file automatically checks it out, right-clicking gives options such as save changes, compare versions, or undo a checkout, and so on.

Check it out!

14 comments:

  1. It's not been nearly that straight forward for me. I can hardly wait for Git support to show up in Team Foundation Server, but I digress.

    I did everything you listed and it's simply not working correctly. There is no "open from source control" option under FILE -> Source Control. The closest thing I've found is FILE -> Open Project. When the dialog opens, on the left side, scroll to the top and choose Visual SourceSafe. Then another dialog opens where you have to choose the correct database. Then yet another dialog opens asking for your credentials. Then you get to browse through the projects in your VSS db and find the .sln file you want and double click it. This pulls down the files, but totally ignores your default project location, putting them in Documents\Visual Studio\Projects\.root\\

    ReplyDelete
    Replies
    1. @Bryan - it is probably the simplest to get the solution manually from VSS into your desired local folder, through the Visual Source Safe UI instead of from Visual Studio, and then use it as usual.

      Please see my reply to @Vssmart below, for some more details.

      Thanks!

      Delete
    2. Git integration is basked into VS2015 and comes via a plugin in VS2013

      Delete
  2. Krisha, thanks for the post! I've gotten fed up with TFS permission errors and decided )for m personal development) to revert back to VSS.

    ReplyDelete
  3. Thank you for these instructions...
    I get the following message:

    ---------------------------
    Microsoft Visual Studio
    ---------------------------
    The selected file is not a valid solution file.
    ---------------------------
    OK
    ---------------------------

    When opening a solution file with File > Open > Project/Solution > Source Safe.
    Visual Studio is opened in Admin mode.

    Do you know a solution?

    ReplyDelete
  4. I have exact same error as "Schooltje" above even I used VS 2010. I try to open a remote project.

    From VS 2010, File > Open > Project/Solution > Source Safe
    I can see the file list in the remote server, then I pick one *.sln file. Then I got error "The selected file is not a valid solution file." Any advice is greatly appreciated.

    ReplyDelete
    Replies
    1. After Googling around for a solution, I found that the very same error message might stem from any number of causes:

      - Multiple versions of VS installed on the machine;
      - A faulty registry key due to an earlier "beta" installed (http://connect.microsoft.com/VisualStudio/feedback/details/533719/vs2010-gives-error-when-opening-solution-from-sourcesafe);
      - The .sln extension being associated with "VS Version Selector" instead of VS2010;
      - Various updates or SPs the system may be looking for.

      The simple workaround that I prefer (because it's easy to do!), is to just create the solution folder locally where you need it, get the latest files from VSS, and then open and use the solution locally:

      - Get to the solution folder in VSS;
      - Make sure to "Set Working Folder" correctly;
      - "Get Latest Version".

      The solution should then remain attached to VSS and you should be able to use it under source control in the normal way. This is, in fact, apparently what a 100%-functioning VS-VSS integration would have done anyway.
      (http://social.msdn.microsoft.com/Forums/en-US/8845b84e-8f60-47f9-afea-6cf1b16185c7/vs-2010-how-to-open-a-solution-stored-in-vss)

      Also, since the solution is already in VSS, it must have been added there from some other machine in the first place... getting it into the same folder path as the original machine may be the best, to avoid other complications.

      Hope this helps!

      Delete
  5. @Krisna: "The .sln extension being associated with "VS Version Selector" instead of VS2010" - this IS the correct association for the sln files, it should be associated with the VS Version Selector. If you associate with an explicit version of VS you're breaking other scenarios (double clicking on an sln file in WindowsExplorer and opening it in the VS version that created that solution).

    FWIW, to make File/Open/Project/Solution/SourceSafe work with VS2010 you need a VSS patch, see http://archive.msdn.microsoft.com/KB976375.


    ReplyDelete
  6. Damn. For VS2012 the File/Open/Project does not work - Microsoft did not release a patch. There you'd have to delete a registry key to make the File/SourceControl/OpenFromSourceControl command appear. I'll need to write a blog article about this. :-(
    Anyway, look under
    HKLM\SOFTWARE\[Wow6432Node\Microsoft]\SourceSafe\Namespace Extension for a registry value DisableOpenFromSourceControl (currently set to 1). Delete that value.
    Also, there is a similar one under Microsoft\SourceSafe\RemoteAccess\Namespace Extension, delete that one as well.
    Now you should be able to open from scc like in VSS 6.0, using the File/SourceControl menu instead of the OpenProject dialog integration....

    ReplyDelete
  7. If you do want to fix the integration of SourceSafe with the File/Open/Project dialog, see http://alinconstantin.blogspot.com/2013/11/using-visual-sourcesafe-2005-with.html
    for what registry key you can set to make TDNamespaceExtension locate the msss parser.

    ReplyDelete
  8. hi

    visual source in not available in the visual studio tools source control drop down list
    please help me out

    ReplyDelete