Home > Uncategorized > TortoiseSVN Visual Studio Integration

TortoiseSVN Visual Studio Integration

I developed this Visual Studio integration whilst migrating a previous company (NC Graphics) from Visual SourceSafe to the brave new world of Subversion.  Developing is a bit of a strong word since it is only a settings file for Visual Studio, but it does the job admirably in a non-intrusive way and has no performance effects at all on the IDE.

The settings file gives you a new toolbar, a new menu, and new items on the context menus in the solution view.  You get some nice TortoiseSVN standard icons to make it even easier.

This all works with Visual Studio 2005 and 2008 (and even the Express Editions), along with a standard installation of TortoiseSVN.  Unless you want to edit the commandline in the External Tools I recommend installing TortoiseSVN to the default location.

It’s quick to set up, just go to your “Tools” menu and choose “Import and Export Settings” and follow the instructions. Ensure the tick box for which settings to import are all ticked.  If the settings don’t work first time, try again, as Visual Studio can be a bit flaky when loading.  It will replace your External Tools because they have to be stored in the correct numbered slot due to the way they are implemented in Visual Studio.

Unfortunately renaming is well beyond the external tools implementation I have used.  TortoiseSVN 1.5 does have some additional functionality to rebuild the links for renamed files which is really useful.

Download Here

Subversion Toolbar

Supported TortoiseSVN operations

The following Subversion/TortoiseSVN features are covered in the integration:

  • Commit – Commit the files to the repository
  • Update – Update the current working version
  • History – Get the history for the selected file
  • Diff – Get the diff compared to the base version
  • Blame – Find out who committed the crimes in the file
  • Revert – Undo local changes
  • Modifications – Check to see if any files have been modified
  • Edit Conflicts – Edit the conflicts that arise from merging/updating
  • Resolve – Mark the file as resolved for conflicts
  • Repository – View the repository on the server
  • Project History – Get the history of the entire project
  • Add Solution – Add the solution being edited to source control
  • Branch/Tag – Perform a branch or tag on the current working copy
  • Settings – Set up TortoiseSVN

Files In The Distribution

SubversionMenu.vssettings

This is a settings file for Visual Studio 2008.  This adds a menu to the IDE for TortoiseSVN with the appropriate icons.

SubversionMenuToolbar.vssettings

This is a settings file for Visual Studio 2008.  This adds a menu for TortoiseSVN as well as a toolbar using the appropriate icons.

SubversionMenuToolbarContexts.vssettings

This is a settings file for Visual Studio 2008.  This adds not only the menu and toolbar, but also adds the items to the appropriate context menus for files and solutions.

SubversionMenuToolbarContextsVS2005.vssettings

This provides the menu, toolbar and context menus for TortoiseSVN in Visual Studio 2005.

SubversionInstall.vbs

Use this file if you want the external tools only.  These will be appended to the list, otherwise use the settings files.  Don’t use in addition to the settings file.

This simply installs a set of External Tools into Visual Studio for common TortoiseSVN operations. It can be installed on versions above Visual Studio.NET (version 7.0). Currently it is configured for Visual Studio 2008 (version 9.0), to make it work on other versions change the variable “strVisualStudioVersionNumber” as outlined in the file’s comments.

Also, if you have installed TortoiseSVN in a non-default location, make sure that you change the variable “strTortoiseSVNBin” to the correct binary path. Make sure that the backslashes are doubled up.

Download Here

Creative Commons License
This work is licenced under a Creative Commons Licence.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • description
  • Reddit
  • Slashdot
  • StumbleUpon

Garry Bodsworth , , , ,

  1. Mindphaser
    August 1st, 2008 at 00:11 | #1

    Thanks for nice integration, but I have some questions about it.
    How to add file/folder and to remove it as well? I didn’t find this possibility. Also, can all external commands be moved from Tools menu item, because its quite inconvenient to have them there?
    I think it’d be very good to have such integration with VS Add-in, possibly I’ll engage with it later.

  2. martin
    August 27th, 2008 at 08:01 | #2

    Is that possible to display the icon overlaying on the files in IDE?

  3. August 27th, 2008 at 08:28 | #3

    I’m afraid it is not possible to do that with this style of integration.

  4. martin
    August 27th, 2008 at 23:52 | #4

    Thanks Garry

  5. Daniel
    August 28th, 2008 at 21:26 | #5

    License?

  6. August 28th, 2008 at 21:38 | #6

    Not really thought about that – you can do what you want with it. I’ve added a Creative Commons license to the end of the post.

  7. Daniel
    August 29th, 2008 at 19:46 | #7

    Ok, thanks.
    I have found a bug.
    I am using xp with visual xpress 2008.
    I installed and works perfect but when I close and open the visual studio then it got corrupted and doen’t show some icons.
    What do you think it is the problem?

    Another suggestion (if it is conceptualy correct) is it possible to add to the solution context menu a “commit to” command? Because it would be very practice for making tags and branches.
    The same for “update to”.
    Thanks.

  8. Daniel
    September 2nd, 2008 at 14:33 | #8

    Any idea about the bug?
    Thanks.

  9. September 2nd, 2008 at 21:11 | #9

    Sorry for the delay. With the Visual Studio settings they get screwed up by VS itself. I’ve seen it happen where some of the icons get disabled. The way to solve this is to reset the settings (through the “Import and export settings” menu items) and then re-import the TortoiseSVN settings.

    As for the “commit to” you really need to create a branch and move your working copy to it. This is because it has to play your actions on top of the branch you are using and is not a one step operation to change branches. There is “Branch/Tag” icon and I recommend using that for branching the working copy you are currently editing. The dialog it supplies allows for various features, such as not switching to the new branch and branching and committing in one step.

    The dialogs are explained very comprehensively here.

  10. Daniel
    September 5th, 2008 at 15:44 | #10

    Ok, thanks for the replay.

  11. Jamie
    September 11th, 2008 at 18:16 | #11

    Is there an easy way to undo the changes made my importing the vssettings files?

  12. September 30th, 2008 at 12:57 | #12

    Thanks. Really need something of this sort.

  13. October 4th, 2008 at 18:56 | #13

    Nice work, but since my Windows is German, apps are installed to “C:\Programme”, not “C:\program files”.
    I suggest to replace the “C:\program files” in your VB script and VSSETTINGS-files with “%PROGRAMFILES%”, making it more common.

  14. October 6th, 2008 at 08:35 | #14

    I’ll have a look at changing that – my main problem is I don’t use Windows very often any more. I’ll try and get the change done tonight. Thanks for the comment.

    Garry

  15. October 7th, 2008 at 03:12 | #15

    I really like what you have done, here it is “But”, is it possible for a version that does not change any of the standard/default toolbars.
    Thanks

  16. October 7th, 2008 at 08:51 | #16

    The VS2008 version has three options – with a menu, with a menu and toolbar, and with a menu and toolbar and context menus. None of the other menus/toolbars are altered on the system.

    Visual Studio when importing any settings does get it wrong by resizing some of the combo boxes and search fields. This is unfortunately an oddity of behaviour with Visual Studio (I have seen it very rarely make some comboboxes take up three lines which is madness). You can just simply resize these toolbar items by right clicking on the background and choosing to edit them, and this allows you to drag the items to the usual size.

    Garry

  17. Robert
    October 8th, 2008 at 17:36 | #17

    Garry,
    Thanks for getting back so soon.
    I’m using Vista with VS Pro-2008 and importing ANY of your 3 options will change not resize the standard tool bar, debug toolbar and build toolbar. It will also remove one of my custom tool bars that holds some of my most used options.

  18. Stan K.
    October 18th, 2008 at 22:06 | #18

    Using VS2008 SP1 on Win XP Pro SP3. I tried to import your settings without checking the box beside External Tools, since I wasn’t sure what I was going to get by checking External Tools. The result is that Subversion is grayed out in the Menu Bar, and also all icons are grayed out. In order to get the Menu to work I had to check External Tools. So in the directions above, instead of saying “Ensure the tick box for which settings to import are all ticked,” maybe you could say something like “Ensure that you tick both the ‘External Tools List’ box and the ‘Menu Customization’ box when importing.”

  19. Stan K.
    October 18th, 2008 at 22:07 | #19

    And thank you very much for providing this service to see many people at no charge. May the Lord bless you richly for your kindness.

  20. Stan K.
    October 18th, 2008 at 22:08 | #20

    “SO many people” instead of “see many people”

  21. Stan K.
    October 18th, 2008 at 23:47 | #21

    Now I’ve run into an issue. On Win XP Pro SP3 when I close Visual Studio SP1 and then reopen it, the Subversion list is grayed out in the Menu Bar. But the toolbar remains. And the tools are still listed under Tools. The Subversion list reappears in the Menu Bar immediately upon re-importing, but disappears again after I close and reopen Visual Studio. The same thing happens even on an account with admin rights.

  22. Peter
    December 16th, 2008 at 11:27 | #22

    Hi!

    How does this tool interact with VS2003?
    I have currently projects that are both in VS2003 and VS2005, both using SourceSafe.
    We concider moving to svn, and I’m looking for the best integration of svn and VS2oo3/o5.

  23. December 17th, 2008 at 09:46 | #23

    Sorry – you can only get access to the external tools part of the integration with VS2003. This requires running that VBS that is in the VS2005 zip but changing one of the command line parameters.

    The reason it will not work on VS2003 is because it requires settings import which is only available in VS2005 upwards.

    Also – when the icons are greyed out you need to reimport the settings. This is a VS2005/2008 issue where it seems to get confused and links the icons to non-existent external tools.

  24. Bernard
    December 19th, 2008 at 09:34 | #24

    The icons always appear greyed for me in Visual Studio 2008. Although it’s not the fully licensed version of visual studio. I’ve tested the VS2005 version for VS2005 and that works.

    Also in the VS2008 settings file

    Visual Studio 2005 Command Prompt

    appears approximately 10 times. I’ve changed 2005 to 2008 and this has no effect.

  25. Richard Brooks
    April 15th, 2009 at 13:36 | #25

    I have just imported the settings from ‘SubversionMenuToolbarContextsVS2008.vssettings’ into a solution that is already under SVN control. However the SVN toolbar and menu are greyed out. I have tried resetting the settings and importing the SVN settings again. But the SVN menu and toolbar is still greyed out.

    Any ideas?

  26. gl
    July 5th, 2009 at 02:21 | #26

    Hi, thanks a bunch for making this available.

    However using the %PROGRAMFILES% env var doesn’t actually work, that’s why all the icons are grayed out. Hardcoding the path does.

  27. July 14th, 2009 at 11:48 | #27

    thanks

    very nice

  28. August 5th, 2009 at 17:55 | #28

    @Laura many thanks. Afraid I don ‘t have time to sign up though it sounds interesting

  29. Robke
    August 13th, 2009 at 09:29 | #29

    Hi, looks great, but for me same problem as Richard Brooks.
    Imported settings, using project already under SVN control.
    All buttons/menu are greyed out (disabled).
    Any suggestions?
    Thanks! Cheers, Rob

  30. Daniel
    December 8th, 2009 at 17:46 | #30

    Hi anyone come up against the issue when you’ve tried to build a solution and the build fails because of acess to ‘….._svn\all-wcprops’ is denied error. I don’t fancy a pre-build event recursive remove readonly flags .bat file! Must be better way.

  31. Jorge Sierra
    December 15th, 2009 at 13:19 | #31

    I download it, it took me 2 secs to make it work.
    Thanks, now I have VS 2008+svn+tortoise integration.
    Thanks again.

  32. Spoook
    December 16th, 2009 at 11:05 | #32

    Hi,

    I just downloaded the zip and double clicked on the subversioninstall.vbs file… I did not saw if it did anything, so I imported the SubversionMenuToolbarContextsVS2008.vssettings file in VS 2008. I have the nice bar, and have the context menu in solution and all, but in my Solution Explorer I don’t have the nice icon’s (you know, green for comitted, red for changed etc etc). Is this how it suppose to work, or did i do something wrong? I would really like the icons (like in explorer)!

  33. scott
    January 7th, 2010 at 17:35 | #33

    is there an uninstall script for the settings? i tried removing them manually but can’t remove the context menu items.

  34. February 8th, 2010 at 17:23 | #34

    hi,
    i’ve modified the script a bit to add the tools to SQL Server Management Studio 2005/2008. contact me if you would like to publish it.

  1. September 21st, 2008 at 01:26 | #1
  2. December 24th, 2008 at 22:30 | #2