Join Michael Lehman for an in-depth discussion in this video Creating a repository and a project, part of Learning Software Version Control.
All right, let's get ready to create some projects inside the TFS. There is only one repository in TFS, and that's on a machine-by-machine basis. The way to create projects inside TFS is first you have to create a team project and then you create folders which hold your individual projects and branches. So first, we are going to create a team project, click there, and we will give it a name so we will call it TFS1 and description of our project is TFS Team Project for Fundamentals of Software Version Control.
We will click Next and with TFS you always have to pick a Process Template. TFS comes out of the box with three Process Templates, Visual Studio Scrum, Agile Software Development 6.0 and MSF for CMMI. We are going to pick Visual Studio Scrum because we are not going to be using all of the features of Team Foundation Server, which has to do with how do you use the work items and how to you use the reporting facilities, and so that's what these templates define, they define work items, they define specific fields, inside the work items for use with Scrum or Agile or CMMI.
In our case, we are simply going to pick Scrum. If you want additional process templates, you can click on this link and Microsoft has a whole library of certified Process Templates. So we are going to pick Scrum, click Next. Now we are not going to branch from any other existing source control so we are just going to click here, and there is our settings that we want to confirm. Yes, we want to call it TFS1, that's our description, we are going to use the Scrum template, and we are going to create a new empty folder with TFS1 at the root, click Finish. All right.
We have successfully created our team project, TFS1 on our default collection of the TFS repository. So we are going to close this, and we are getting ready to create our first actual set of folders. In this chapter, we are going to use C# instead of C for our sample code. It is easily adapted from our examples we have done before, and Visual Studio's TFS integration is very easy to see and use using C#. So we will come over here to the Start page, we will click New Project, and we are going to pick Console Application, and we are going to put this in a directory we are going to call c:\FSVC1, and we'll call the Solution name.
We are not going to automatically add it to source code control because I want to show you how to add some of the source code control if you already have an existing solution. So we will just click OK here and up pops our main Program.cs. We are going to close that because we are going to use different files and here we now we can see in the Team Explorer that we can look at the Source Code Control Explorer, so we are going to do that, and now you can see here, here is our root repository, here's our team project. All we have is the BuildProcessTemplates under that, we don't have any folders, but we are about to create that.
You can also now see that here is the local path for where this stuff is stored for the repository, not for the folder. So let's go back to the Solution Explorer. Here is our typical Solution Explorer for C# project. We are going to get rid of Properties here in visual studio. What you don't see is this column right here, the blank column, is where Source code control information such as, "Is it checked in?", "Is it modified?", and so forth is going to appear. So the way we get stared with that is we right-click on the Solution node and select this, Add Solution to Source Control, the Add Solution to Source Control dialog pops up and asks us where we want to store our solution inside the TFS server.
In this case, we want to put it inside our TFS1 team project, and we are going to have a solution folder. We are going to not name it Console Application 1, we are going to call it TFSSample, and we are going to click OK. And now we can see a few things. Inside our TFS team project, we now have a folder called TFSSample. Now this is conceptually the same as a Git repository, a Mercurial repository or an SVN repository, that particular folder. As we do additional operations, we will all be operating inside that folder.
You can see this green plus here indicates that this particular folder has been created and associated with this repository but not yet checked in. So we open it up here, we can see inside this folder is our ConsoleApplication, inside that is the Properties folder. The Folders column only shows folders, not the actual files. Over here if we look inside the Files, you can see here are all the files that are associated with that particular thing. And note now that this TFSSample folder is exactly where we told it to be, inside the FSVC1 folder and the ConsoleApplication folder was created by the new Project Template to hold the rest of our files.
We have got everything set up, now let's check in our changes. To do that, initially here we come to the Team Explorer. You can see here are our Pending Changes. We are going to enter in the Comment and click the Check In button. Visual studio will give you this Check-in Confirmation dialog every time you check in if you want. In our case, I am going to click the Don't prompt again because I am going to assume that I know when I am checking in what it is I want to change, or I can also look at this Pending Changes dialog at any time. All right.
Now you can see Changeset 10 successfully checked in. Your numbers may vary. It might be Changeset 1 when you first do that. We did a little bit of a setup on the system to verify TFS is working before we started to record this chapter, but that's the Changeset number, and TFS uses the word Changeset to identify things and uses numbers. So now you can see all of our green plus signs are gone. Come back to the Solution Explorer, there is now a blue lock indicating that the files are checked in. So the Solution Explorer acts very similar to shell integration that you might see in other Source code control systems. So that's it.
We have got our team project created, we've got our Visual Studio project created, we have got our folders created, we've got our initial stuff checked in, let's get on to making some changes and checking in and checking out and looking at history.
- Comparing centralized vs. distributed systems
- Saving changes and tracking history
- Using revert or rollback
- Working with the GUI tools
- Using IDE and shell integration
- Installing different systems
- Creating a repository
- Tagging code
- Branching and merging code
- Selecting a software version control system that's right for you