Visual Studio Tools For Git VS Git Source control provider [duplicate] - c#

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
As a long-time Visual SourceSafe user (and hater) I was discussing switching to SVN with a colleague; he suggested using Git instead. Since, apparently, it can be used as peer-to-peer without a central server (we are a 3-developer team).
I have not been able to find anything about tools that integrate Git with Visual Studio, though - does such a thing exist?
What are the technologies available for using Git with Visual Studio? And what do I need to know about how they differ before I begin?

In Jan 2013, Microsoft announced that they are adding full Git support into all their ALM products. They have published a plugin for Visual Studio 2012 that adds Git source control integration.
Alternatively, there is a project called Git Extensions that includes add-ins for Visual Studio 2005, 2008, 2010 and 2012, as well as Windows Explorer integration. It's regularly updated and having used it on a couple of projects, I've found it very useful.
Another option is Git Source Control Provider.

I use Git with Visual Studio for my port of Protocol Buffers to C#. I don't use the GUI - I just keep a command line open as well as Visual Studio.
For the most part it's fine - the only problem is when you want to rename a file. Both Git and Visual Studio would rather that they were the one to rename it. I think that renaming it in Visual Studio is the way to go though - just be careful what you do at the Git side afterwards. Although this has been a bit of a pain in the past, I've heard that it actually should be pretty seamless on the Git side, because it can notice that the contents will be mostly the same. (Not entirely the same, usually - you tend to rename a file when you're renaming the class, IME.)
But basically - yes, it works fine. I'm a Git newbie, but I can get it to do everything I need it to. Make sure you have a git ignore file for bin and obj, and *.user.

Git Source Control Provider is new plug-in that integrates Git with Visual Studio.

I've looked into this a bit at work (both with Subversion and Git). Visual Studio actually has a source control integration API to allow you to integrate third-party source control solutions into Visual Studio. However, most folks don't bother with it for a couple of reasons.
The first is that the API pretty much assumes you are using a locked-checkout workflow. There are a lot of hooks in it that are either way expensive to implement, or just flat out make no sense when you are using the more modern edit-merge workflow.
The second (which is related) is that when you are using the edit-merge workflow that both Subversion and Git encourage, you don't really need Visual Studio integration. The main killer thing about SourceSafe's integration with Visual Studio is that you (and the editor) can tell at a glance which files you own, which must be checked out before you can edit, and which you cannot check out even if you want to. Then it can help you do whatever revision-control voodoo you need to do when you want to edit a file. None of that is even part of a typical Git workflow.
When you are using Git (or SVN typically), your revision-control interactions all take place either before your development session, or after it (once you have everything working and tested). At that point it really isn't too much of a pain to use a different tool. You aren't constantly having to switch back and forth.

I find that Git, working on whole trees as it does, benefits less from IDE integration than source control tools that are either file based or follow a checkout-edit-commit pattern. Of course there are instances when it can be nice to click on a button to do some history examination, but I don't miss that very much.
The real must-do is to get your .gitignore file full of the things that shouldn't be in a shared repository. Mine generally contain (amongst other stuff) the following:
*.vcproj.*.user
*.ncb
*.aps
*.suo
but this is heavily C++ biased with little or no use of any class wizard style functionality.
My usage pattern is something like the following.
Code, code, code in Visual Studio.
When happy (sensible intermediate point to commit code, switch to Git, stage changes and review diffs. If anything's obviously wrong switch back to Visual Studio and fix, otherwise commit.
Any merge, branch, rebase or other fancy SCM stuff is easy to do in Git from the command prompt. Visual Studio is normally fairly happy with things changing under it, although it can sometimes need to reload some projects if you've altered the project files significantly.
I find that the usefulness of Git outweighs any minor inconvenience of not having full IDE integration but it is, to some extent, a matter of taste.

Microsoft announced Git for Visual studio 2012 (update 2) recently. I have not played around with it yet, but this video looks promising.
Here is a quick tutorial on how to use Git from Visual Studio 2012.

Also don't miss TortoiseGit...
https://tortoisegit.org/

There's a Visual Studio Tools for Git by Microsoft. It only supports Visual Studio 2012 (update 2) though.

Visual Studio 2013 natively supports Git.
See the official announcement.

The Git support done by Microsoft in Visual Studio is just good enough for basic work (commit/fetch/merge and push). My advice is just to avoid it...
I highly prefer GitExtensions (or in less proportion SourceTree). Because seeing the DAG is for me really important to understand how Git works. And you are a lot more aware of what the other contributors to your project have done!
In Visual Studio, you can't quickly see the diff between files or commit, nor (add to the index) and commit only part of modifications. Browse your history is not good either... All that ending in a painful experience!
And, for example, GitExtensions is bundled with interesting plugins: background fetch, GitFlow,... and now, continuous integration!
For the users of Visual Studio 2015, Git is taking shape if you install the GitHub extension. But an external tool is still better ;-)

TortoiseGit has matured and I recommend it especially if you have used TortoiseSVN.

The newest release of Git Extensions supports Visual Studio 2010 now (along with Visual Studio 2008 and Visual Studio 2005).
I found it to be fairly easy to use with Visual Studio 2008 and the interface seems to be the same in Visual Studio 2010.

The simplest solution that actually works quite well is to add the TortoiseGit commands as external tools.
Solution to adding a Git (TortoiseGit) toolbar to Visual Studio

As mantioned by Jon Rimmer, you can use GitExtensions. GitExtensions does work in Visual Studio 2005 and Visual Studio 2008, it also does work in Visual Studio 2010 if you manually copy and config the .Addin file.

Currently there are 2 options for Git Source Control in Visual Studio (2010 and 12):
Git Source Control Provider
Microsoft Git Provider
I have tried both and have found 1st one to be more mature, and has more features. For instance it plays nicely with both tortoise git and git extensions, and even exposed their features.
Note: Whichever extension you use, make sure that you enable it from Tools -> Options -> Source control -> Plugin Selection for it to work.

As of 2013-02-11, the Microsoft Git plugin for Visual Studio 2012 should work with the Express version as well.

Related

How can I manage my projects versions using Visual Studio 2012 Professional

I am working on developing an asp.net mvc web application , using visual studio 2012 professional. now when I want to update my project, for example by adding new features, I do the following steps:-
I copy the project folder.
past it inside a "versioning" folder.
work on the original project , were I add the new features and code.
now if I want to revert my project back before the new features, I can open the folder inside the "Versioning" folder. and so on...
now my current approach is some how sufficient.. but I am trying to find a more automated approach where I can for example revert certain file let say a certain .cs file to its previous version , or revert back my whole project to certain point.
so can anyone advice how Visual studio 2012 can help me in managing my versioning ?
Thanks in advance for any help.
Regards
You'll want to use a version control system like Team Foundation Server (TFS), Git, Mercurial, Subversion, etc. I personally recommend Git. Many of them have a means of integration with Visual Studio 2012 (for example, see How to Connect Visual Studio 2012 with git (github)?). Version control software supports features such as tracking file changes, creating code branches, merging code from different commits/users back together, etc.
Here's what a very simple workflow might look like with version control (see https://guides.github.com/introduction/flow/ for an example of the GitHub flow):
You're ready to add a new feature/start a new version. For simplicity we'll assume you're working on a single branch (e.g. Git "master" branch).
As you program, you make incremental changes to you source code and commit those changes regularly. Each commit gives you a snapshot of the work you've done and you can go back to any commit at any point and compare the changes between commits. The VCS you choose will influence how you synchronize those changes with a central/remote repository. You can even check revision history and look at previous versions of specific files and your code is typically backed up on another server for you without much additional work.
When you're ready to release, you could tag a specific revision (or merge features branches into master, or ... etc.). Whatever the case, you can keep track of all the cumulative changes you've made for each release and be able to revert back to any point.
There are a few other steps you may consider for versioning such as updating the assembly information. In the AssemblyInfo.cs file there is assembly metadata specifying the assembly version, file version (or informational version, which I prefer). See What is AssemblyInfo.cs used for?. You can configure Visual Studio to auto-increment the version numbers.
Team Foundation Server should be available by default with VS 2012, although I'm vague on the details of setting up a TFS server to host your repositories. Visual Studio added direct support for Git (open source, very popular) starting in VS 2013, however there is an extension available for 2012 (https://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c). The extension allows you to perform some of the most used Git functions such as committing, branching, and pushing.
Here are some links to get you started:
Why should I use version control?
Using Git with Visual Studio
https://git-scm.com/download/win
https://tortoisegit.org/
https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx
I use VSTS and it is fantastic. You can use GIT or TFS version control. Both are hosted by Microsoft. I prefer Microsoft due to the idea of long term support and reliability. You can see they are supporting VS 2008 to current.
https://www.visualstudio.com/team-services/pricing/
It is also free for up to 5 users.
From the link posted below.
It has full support for many versions of Visual Studio
Q: Which versions of Visual Studio can I use with Visual Studio Team Services?
A: You can use:
Visual Studio "15"
Visual Studio 2015
Visual Studio 2013
Visual Studio 2012
Visual Studio 2010, requires Service Pack 1 and KB2662296
Visual Studio 2008 SP1, requires GDR update To connect to Team
Services with
Visual Studio 2008 through 2012
Start Visual Studio.
From the Team menu or Team Explorer, go to Connect to Team Foundation Server > Select Team Projects > Servers.
Add your Team Services account ({youraccount}.visualstudio.com).
Select your team project, and finish connecting.
If you get connection errors, try choosing HTTPS as your protocol.
https://www.visualstudio.com/en-us/docs/setup-admin/team-services/connect-to-visual-studio-team-services
GIT Vs TFS Version Control - https://www.visualstudio.com/en-us/docs/tfvc/comparison-git-tfvc
One thing to look into is how you visualize editing and checking in code. I personally find that TFS version control follows a very simple and linear model. I prefer it to git. But its really Apples vs Oranges and usually people like what they are used to. I will say that Git currently is in active development and is not as feature rich as TFS-VC. Not to mention VSTS hooks into their entire ecosystem of plugins, build systems, test infrastructure and all of their cloud platform "Azure"
If you dont need to be sharing your version controlled stuff, I like TurtleSVN. Its simple and I like the UI it has for displaying modifications between versions. It adds a choice on the right-click menu of any file or folder in windows explorer for "TurtleSVN" and then all of the operations can be handled from there.
My Suggestion is still using TFS - I my project which is a product ( ASP.MVC application ) - we are using following structure in TFS..
we have a main branch - DEV branch a QA branch and a SP branch. See screen shot attached)
Main Branch - Where all the code is merged using scripts - before we start with new version of development and then a new DEV branch with version is created from this main branch.. - so we have track of every version and new features added to each version... and For new client the code from Main branch is given.
Dev - Based on features added we create different folder for each new set of features / enhancements and put the version.
SP - After development is completed - the DEV branch is freeze and we create a new branch id SP and deploy the code for QA team - any defect founs are fixed in SP and deployed to QA - once testing is done the code is SP is freeze with QA approved and deployed to main and provided to Clients..
Finally using script - every thing from SP is merged in to Main.. and for new development - a new Branch in DEV is created from the Main..
This way we have track of enhancements / feature for each DEV phase and related SP is available and our product is getting developed in Main.
Hope this Helps..

Text file diff library (MS licensed)

Does anyone know if there a way to tap into visual studios diff libraries to extend the functionality of my projects?
I know that there are open source solutions for file diffing that I will consider if I cant find an adequate Microsoft implementation of it. Visual Studio comes with nice diff feature that it uses to compare source files.
I want to use code that is MS licensed. It seems that visual studio fulfills that requirement and has the feature I need.
It seems like this would be a useful extension library that maybe .NET should have in it, or already does?
Any ideas?
The Visual Studio diff window (new to Visual Studio 2012) uses the IDifferenceBufferFactoryService to create the IDifferenceBuffer it displays. From there it uses the ITextDifferencingSelectorService to get the appropriate ITextDifferencingService for each side. From there you'll have to do a good bit of reading to understand the API. :)
If you are creating a Visual Studio 2012 extension, the API you are interested is available in the Microsoft.VisualStudio.Text.Differencing namespace.

Visual Studio version-agnostic projects/solutions: is it possible?

I remember seeing an open source project within the last year that I was able to open in both VS 2008 and VS 2010 without an upgrade wizard popping up. I think...
Is it possible to create a project/solution that will open up in any version of Visual Studio without prompting me to run the upgrade wizard? If so, how do I do this?
Information for both C++ and C# projects would be most helpful.
You can, use CMake and generate VSx solution.
I think the project that you have seen had 2 visual studio solutions for different visual studio versions.
Update:
Also, you can use http://sourceforge.net/projects/vspc/
or see http://www.emmet-gray.com/Articles/ProjectConverter.htm
The solution format hasn't changed significantly over the visual studio versions except the version number.
If the code itself is generic enough (not using linq, etc) then you can edit the first line of the solution file to "downgrade" the version.
VS2005 uses:
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
You can give the Prebuild project a try to generate needed solution files on the fly.
Prebuild is a cross-platform XML-driven pre-build tool which allows
developers to easily generate project files for major IDE's and .NET
development tools including: Visual Studio .NET 2002, 2003, 2005, 2008, 2010
SharpDevelop, MonoDevelop, NAnt and Autotools.
May be it is not what you ask about, but you can convert you project into nmake target
The only way to do this is to create separate solutions (for 2010 and 2008), and include existing projects to different solutions. Create new projects in VS2008, and then add them to VS2010 solution.
You may need something like round-tripping
Round-tripping is the ability to use a current or previous version of Visual Studio to target a platform that is supported by both versions of VS. For example, with round-tripping, you can open projects from a previous version of VS in a newer IDE without the need for conversion, thus allowing you to work side-by-side on old and upgraded projects.
Read more

Version Control in Visual Studio

I'm currently working on a large project, and am about to make some large changes, and was looking for a way to 'backup' my prior work. Is there built in functionality in Visual Studio to work with version control?
This project is developed only by me, and doesn't use Team Foundation Server (which is what most of my googling seems to give me answers on). Ideally, I would like to identify and restore all the different versions of my program as it evolves, without having to worry about totally messing something up...
Cheers and thanks in advance!
---EDIT---
With a version control system though, would that be stored on a seperate server? Or is it possible to store it locally? I'm more just concerned that I will just seriously mess up my code and not be able to undo it at some point...
There are several third-party source control integration tools, such as AnkhSVN or VisualSVN for SVN repositories (I use the former and can gladly recommend it). As far as "built-in", Visual Studio supports Team Foundation Server and Visual Source Safe out of the box, but those are both paid products and VSS should be avoided (in my opinion) for any new work.
Personally, I use TortiseSVN (for Windows integration) and AnkhSVN (for VS integration) with our SVN repository. There are free SVN servers as well, so you can get by with a very good solution while paying $0.
Well, there are a number of free source control alternatives out there and there are plug-ins (free ones) into Visual Studio that will allow you to hook right in. Take a look at those links and pick one that works for you!
Visual Studio has the ability to work with many source control providers. You simply have to hook them up.
Use "Tools->Options->Source Control->Plug-in Selection".
You may be able to use git with VS which means you don't need another dir/server etc for the repo. Consider Using Git with Visual Studio
TFS is really expensive, especially for just you. You can use VisualSVN.
it is a free download to us ANkhsvn. It is a plugin for visual studio that connects to various source control severs. You would first have to have a subversion server setup somewhere. Which is easy enough to do.
There is no built-in Version Control System in VS.NET, however, VS.NET supports multiple version control systems, like TFS, Visual Sourcesafe, SourceGear vault , etc...
As you state, you need a version control system. Look at this answer on selecting a Version Control System.
There are many version management systems. A lot of them are expensives, but... the are many others that are free! Take a look here:
http://producingoss.com/en/vc-systems.html
You can use SVN (Subversion) - one of the most used widely.

Extending the Visual Studio editor

I'm writing an add-in for extending Visual Studio 2008 (adding custom functionality). While doing that I came across a situation where it would be good if I could provide custom messages via tooltips for any line of code.
Doing this IMO requires accessing the VS editor control and by some way displaying the respective tooltip. This might also be visualized like breakpoints that on mouse hovering provide a tooltip message.
Is this implementation possible? If yes, what's the way to go? If not, what similar way do you suggest?
In a recent episode of Hanselminutes, they discussed how much more extensible the VS 2010 editor is going to be. Based on what they said, I think it will be rather difficult (although probably possible) until they introduce that extensibility.
Yes it is. You can add more customization on the code editor of VS 2008, even you can create your own language service with your own intellisense support in VS 2008.
You can do this simply by using VS 2008 SDK, and you can also quickly play with the standalone shell of Visual Studio 2008, and MS SQL Server 2008 Management Studio is one example of customized Visual Studio standalone shell.
You can visit MS Visual Studio Extensibility:
http://msdn.microsoft.com/en-us/vsx/default.aspx
And lots of videos on VS 2008 SDK:
http://msdn.microsoft.com/en-us/vsx/bb507746.aspx#extensibility
You should take a look at Resharper and work out whether your add-in would be better suited to being a Resharper Plug-In. This approach would require your users to buy Resharper, but this sort of thing is exactly what it does.
For example, check out http://stylecopforresharper.codeplex.com/ where this sort of hint/tooltip stuff in Resharper is used to highlight lines of code that have StyleCop issues.

Categories