53

I just installed AnkhSVN to have subversion support from within Visual Studio 2010. I noticed I had to go to Tools > Options > Source Control to select the current source control plugin.

At the moment, I'm working on multiple projects using different version control systems. For instance, I also have some projects in Mercurial, for which a VS source control plugin is available.

Is there any way to specify the source control plugin on a per-solution basis? Or can VS detect the used vcs automatically? What are the best practices in this respect?

Edit: a google search led me to How to configure Visual Studio to use different source control providers and Can Perforce and SourceSafe co-exist in Visual Studio?. Both cover the same ground, but appear to be specific to specific vcs and lack a satisfying general answer. I'm looking for a general answer here.

Community
  • 1
  • 1
Marijn
  • 10,367
  • 5
  • 59
  • 80
  • +1 as I have the same issue switching from TFS and Perforce. – Fueled Jan 20 '12 at 21:46
  • 1
    Seems like the linked references more or less answer the question. If the source control plugin used by Visual Studio for a particular source control system supports source control integration bindings then they will be recorded in the solution file. Visual Studio should utilize those bindings when it opens up the solution to select the appropriate source control provider. – Matt Glover Jan 30 '12 at 03:13
  • I do not thing that is possible unless you install some plug in that will do this for you. – cpoDesign Jan 30 '12 at 09:07
  • 1
    SVN and GIT are probably the pair most people switch between. – dotNET Oct 16 '16 at 15:04

3 Answers3

32

There is unfortunately no good answer here. You will simply have to go in and manually change you visual studio source control provider settings before you open the project. This is a limitation of how this particular plugin system works, and will probably take a new version of visual studio to specifically address it.

This is an instance where visual studio works better for the enterprise shop with standardized source control tools, and not as good for a contractor working with multiple clients across an array of technologies.

Joel Martinez
  • 46,929
  • 26
  • 130
  • 185
  • 1
    I'm afraid that this is the correct answer ... I'll leave it unaccepted for the coming week or so, but I don't have much hope for a better answer. – Marijn Feb 04 '12 at 18:21
  • I keep expecting this to be addressed with each new version of Visual Studio, but it hasn't; maybe everyone is assuming someone else will complain. Maybe we're all doing it wrong. :-) Even in the enterprise space, it is become pretty normal to be working with several solutions in different source control systems. Someone should add a request on connect for this. – N8allan Aug 07 '13 at 23:12
  • 1
    Has this been fixed in VS 2013? – Ken Burkhardt Nov 21 '13 at 14:18
  • Hah, no. I'm here looking for VS2013 answer to this. – SilverSideDown Nov 26 '13 at 16:11
  • 3
    I'm using VS2013 and it *has not* been fixed. Such a shame. – marquito Dec 16 '13 at 10:25
  • 8
    Vote for it! http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2520134-ability-to-configure-source-control-settings-per-p – Mark Melville Mar 18 '14 at 16:00
  • @MarkMelville, I did vote for this (3 votes), but I even have a need to have multiple providers *in the same solution*. Our contract developers use GitHub b/c we can't give them access to our internal VCS, and I need to update both version control systems on the same solution. It's really a many to many relationship, not just a one to one relationship on the solution level. – toddmo Aug 26 '15 at 15:26
  • 2
    Its version 2017 now and still this feature is absent. I guess it must be very very very hard to implement. Lets hope Quantum Comptuing can fix it in future. :P – deathrace Mar 12 '18 at 12:47
7

Source control provider auto switching based on reserved directory presence can be done with a VS extension as described here.

Community
  • 1
  • 1
ceztko
  • 14,736
  • 5
  • 58
  • 73
  • It's a shame this auto switches it would be great if I could just tie the option to a solution or project file to give me more flexibility over when a certain source control provider is used. – user692942 May 01 '15 at 14:23
  • 1
    What is a shame? Can't understand, sorry. The option to persist the Scc provider in the solution is built in VS but as far as I know it's broken and never fixed by Microsoft at least in VS2010. Also the approach it's plainly wrong: what if the same solution is distributed by different RCS (for example, git and subversion)? This is quite common. SccAutoSwitcher detects the correct provider you have in the local checkout, what is wrong with that? – ceztko May 01 '15 at 16:04
0

Now we have 2023, and VS still supports only one SourceControl provider at a time. If you are looking for a solution that supports SVN and GIT and you use Tortoise SVN you can handle it like I do:

Set the options to the "GIT" Plugin. Projects with GIT will work Install the extension "TSVN 2022", it will provider a layer to the installed TSVN-Tools from VS. This way I can work with Projects in both systems without a need to change the options everytime.

Ulli
  • 500
  • 1
  • 7
  • 19