Visual Studio 2013 Preview: Git version control and Team Foundation Build

I’m here today (and trying real hard to not be jealous of those of you reading this from beautiful San Francisco) to share some new information about version control and Team Foundation Build (TFBuild) in Visual Studio 2013 Preview.

  • Version control
    • Git built in to Visual Studio and TFS
    • Use branches to switch contexts and isolate risk
    • Resolve conflicts
    • Work around a few known issues
    • More of what’s new
  • Team Foundation Build
    • Build Windows 8.1 Preview Store apps
    • Build more simply. Build in Git!
    • Scripts!
    • Customize your build processes
  • Questions

Version control

I doubt many of you are surprised to hear that one of our big investments for this release is Git.

Git built in to Visual Studio and TFS

Since January we’ve offered Git as a Visual Studio 2012 extension and on Team Foundation Service. Beginning today:

  • Visual Studio 2013 has Git built in and ready for you to work with new or existing Git projects, no matter where you want to work: locally, on TFS (service or on-premises ), or with another service such as CodePlex or GitHub.
  • Team Foundation Server 2013 gives you the same enterprise-grade scale, security, and availability that you’ve already enjoyed with Team Foundation Version Control (TFVC), but now with Git. Details from Brian: http://blogs.msdn.com/b/bharry/archive/2013/06/19/enterprise-grade-git.aspx.

Use branches to switch contexts and isolate risk

Plenty has already been written about Git branches. To understand how they work, I encourage you to read Git-scm: Git Branching. Now let’s take a few moments to look at how you can work with Branches in Visual Studio and TFS.

Creating a branch is a super lightweight (and thus very fast) operation. In Git, when you create a branch, you are simply creating a new reference to a commit. For a detailed explanation, see Git-scm: Git Branching – What a Branch Is. You can create as many private branches as you want locally.

Alternate Text

You don’t have to share (“push” to remote) with anyone else right away, or ever. As you make changes, they are tracked in the history of the branch:

History of a branch

When you are ready, you can delete the branch if you don’t want it, merge it back into your “master” branch, or push it to your remote repository so your teammates can work on the branch with you.

Publishing a branch

In Visual Studio, when you are ready to work on a branch published by one of your teammates, you create a new branch based on the remote branch.

Downloading a remote branch

In web access (Keyboard: Ctrl + 0,A) you can select a branch and see how it compares with all your other branches. For example, here we see that the newIdea branch is missing two commits that master has, but that it also has three commits that master does not have.

Comparing branches

When you are ready, you can merge one branch into another.

Merging branches

As useful and powerful as branches can be, there are some tradeoffs whether you are in Git or TFVC. When you want to merge one branch into another, often you must first…

Resolve conflicts

Conflicts occur in pretty much the same circumstances whether you use Git or TFVC: when merging two branches and combining your changes with those from other members of your team. You can manually resolve conflicts in Git version control in a similar way to how you do it in TFVC.

Work around a few known issues

Error message in Team Explorer: Value was either too large or too small for an Int32: One cause of this error occurs when your are using Solution Explorer. To resolve the issue:

  1. Close the solution.
  2. Restart Visual Studio.
  3. Make sure the solution is still closed.
  4. Take the same action again (e.g. push, pull, merge, or sync) using the relevant page in Team Explorer instead of from Solution Explorer. 

Error message from webpage: window.external.notifyToken is not registered: You will see this error when you don’t have cached credentials to your Team Foundation Service account and you try to authenticate during a Git operation. To resolve the issue, go to another Team Explorer page such as Work Items, and then take an action such as running a query. We plan to release a fix for this issue soon for Visual Studio 2012 in a new version of the Git provider. The fix will also be included in the next version of Visual Studio 2013.

More version control

There are several other new version control features. For example you can Undock Undock pages such as Pending Changes and persist them as independent  windows.

See What’s new in version control

Team Foundation Build

There is plenty of new value for your team in Team Foundation Server 2013 Preview when it comes to automated building and testing of your code.

Build Windows 8.1 Preview Store apps

Are you using Team Foundation Service? Do you want to use the hosted build controller to build Windows 8.1 Preview Store apps? You can do it. Here’s how: Hosted Build Controller: Build Windows 8.1 Preview Store apps.

Build more simply. Build in Git.

We’ve simplified the build process parameters. And of course now you can to build the code you store in a Git team project, and you can generally do everything you can do with code stored in a TFVC team project. One notable exception: you cannot define a gated check-in build in a Git team project.

See Use the Default Template.

Scripts!

Before you invest in a custom build process, would running a script during the build meet your needs? If so, you run your batch and PowerShell scripts before and after MSBuild compiles your code, and also before and after your tests are run. We provide your script with access to environment variables they need to get the paths to working and output directories, as well as other information about the build.

See Use the Default Template to run your scripts.

Customize your build processes

We expect that the ability to run a script will relieve the need many developers might have had to customize their build process. But for those who still need to put their own secret sauce into their build processes, in this release we’re aiming to make that easier to do. We’ve simplified the default build process templates, using coarser activities so that it should be easier to find the spot where you need to insert your custom build logic.

Editing a build process template from a solution

 

Hello world in the build summary Excerpt from a Hello World custom build process activity

If you’ve wanted to create a custom build process but just didn’t feel you could invest the time to get started, I challenge you to give “Hello World” a go using this updated and expanded guidance.

See Create a custom build process.

More TFBuild

Want to know what else is new for TFBuild? See What’s new in Team Foundation Build.

Comments? Questions?

I invite you to post your comments here.

For questions, I encourage you to post them on our newly revamped forums: http://social.msdn.microsoft.com/forums/en-us/home.