Monday, August 18, 2014

Integrate XCode with TFS for Version Control

Same as Visual Studio is the IDE for Windows app and Windows Phone app developers,  XCode is the IDE for Mac OS and iOS app developer. Microsoft TFS server is the ALM platform for Microsoft platform application development, and one of the most important features is source code version control.

For version control, XCode supports git protocol and provides local git repository.   for an individual developer, and assuming your mac book does not die on you, local git repository is good enough. however, if want to have your version control to be stored remotely independent of your local mac book computer or you want to work with a team of fellow developers on the same project and same version control repository, local git repository  will not be good enough.
One of the solutions are gitHub, with gitHub you can have your remote git repository for your project. However, there are a few concerns in using gitHub. For one, if you want it to be free, your code need to be visible to the world.  If you are developing app for money, your source code is you intellectual property, you want to protect it in the best way you can.  If you have a sizable team doing development, the running cost is not non-significant.

Well, I have good news for you if you already have TFS server assessable to you. There are some third party plug-ins available for XCode to work with TFS prior to TFS 2013.  the better news is starting TFS 2013, TFS supports git protocol natively.  

I have a TFS 2012 server in my lab, and I want to use my TFS server as version control service provider for my iOS app development in XCode. This article will share with you the process and areas you need to pay attentions to. first of all,


Let’s get it started. The first step is of course, upgrading my TFS2012 to TFS2013.

There is a article in MSDN on the topic, which is quite comprehensive, instead of repeat what it said, I will provide the link to it. Check out the link below for detail.

 In-place upgrade from TFS 2012 to TFS 2013

However, it is not trouble free. After a few hours of upgrading, I was so eager to start my Visual Studio 2013 to create a Team project for my iOS project. To my surprise, I got a system exception with the message that does not make much sense. I was a bit discouraged, this is Visual Studio 2013 accessing TFS 2013, both are 2013 version, they do not work together?


After some search on the internet, I found this is a known issue, the solution is to apply Visual Studio 2013 update 2.

After applying update 2 for my visual Studio 2013 ( it took me about 30 minutes, so be patient), I was able to create Team project.

On the window where to specify Version Control System, different from previous TFS server, now you can chose either Team Foundation Version Control or Git.

I chose Git and complete the rest of steps created the Team project.

The next step is to go to the team project using TFS web interface,  on Code table you will see following screen:

Copy the URL and move on to XCode in your Mac Book

On your Xcode, click on Source Control menu item, select the current working copy, and configure your working copy. On remotes tab, click on + sign to “Add Remote” and provide the URL you copied from TFS web site then click Done.

Under <XCode><Preference> click on the Repository you just created and provide the necessary credential for the git Repository, then close it.

After all these are done, you are set for pushing your source code version history to TFS git Repository. 

Click on <Version Control> , you will find you not only can <Commit> but also can do Push and Pull.  When you do Push, you meant to push your local version history to TFS Git Repository and when you do Pull you meant to pull the TFS Git Repository to your local Git. 

When you commit, you have the option to push your commitment to remote Git Repository.

No comments:

Post a Comment