http://msdn.microsoft.com/en-us/ff645221 (ZH-CN). aspx
Tutorial: VS2010 's Introduction to TFS Guide
[Original post address] Tutorial:getting started with TFS in VS2010
[Original publication Time] Wednesday, October, 2009 1:00 PM
Earlier this month, we released the new TFS infrastructure configuration. This configuration facilitates the creation of a TFS version that supports source management, work items, and builds (builds). This is a good opportunity to migrate your resources on the VSS (Visual Source Safe) to TFS, and you can also choose some new features. Now that the official version of VS2010 Beta2 has been released, here is a guide to getting started on the system.
This article will be most helpful to those who have not yet installed or used TFS. TFS has good support for complex environments. For example, reports, SharePoint consolidation, support across multiple domains, distributed databases, and so on. But I'm not going to tell you any part of it here, my goal is to help you understand why we choose TFS and how to use it. If you are a user of VSS, in future articles, I will describe how to migrate the VSS database to TFS.
In the diagram above, each system has its own storage space, resource identity set, commands, and toolset. To get the whole system working, it's like connecting a set of custom solid components together: it's achievable, but it's a huge workload, and it can be a mistake in some places.
What I want more is a system that can integrate these tasks together and implement my default workflow.
This consolidation implements some of the most common scenarios. For example, every day I edit the source code, build the product and test it, report bugs and fix it, and cycle. When there is a consolidated system that can support all of these workflows, all of the work can be correlated. For example, when I check in a bug fix, I'd like to see the change set recorded when the bugs are resolved. (see the example below)
The basic configuration of TFS allows you to do this precisely. This is a huge step forward compared to simple source management. The full version of TFS will incorporate new features, including automated testing, deployment of virtual labs, and schema validation. Here is the expanded workflow:
When you use the visual Studio enhanced and flagship version, you can choose to install these new components as needed.
There are many ways to access TFS. Developers often access it through Visual Studio. The tester can access TFS with the new test and Lab Manager (no need to install VS). If you are a project manager, you can also access TFS via the Web interface, Excel,microsoft project, or dashboards's moss support (VS2010 's new features). More relevant content to be introduced later.
In the remainder of this article, I'll show you step-by-step how to use the infrastructure configuration to start our first TFS project.
Getting Started Guide
Now, with a conceptual level of understanding, it's time to connect them. Start with the steps listed in Brian Harry's TFS article. All the necessary software will be installed on your machine in the form of a default set (called Defaultcollection).
Here we can connect to TFS through Visual Studio. The easiest way to do this is to use the menu "team" (You can also use the links on the start page):
Here you need to enter the server name for TFS. For example, my Windows 7 machine: Jlzb2rel. Add the server to the list by adding a button, and then click Close:
Here, you can select the server from the combo box, then select Defaultcollection, then click Connect:
The Team Explorer tab now has server connections and defaultcollection, but we don't have a TFS project that can store things:
I created a new Windows Forms project for this tutorial as a sample of our solution (file, new project, Windows Form). If you try to add a new code project to source control, there will be an error. For example:
After you select the Add Solution to source Control menu item, you will receive an error message for "No available team Project source control folder":
This error is not intuitive (especially if the word item provided is used in TFS and your code solutions, and they are different concepts). This error means that you must create a real TFS project to include resources that are useful in your work. In Team Explorer, right-click your collection and select New team project:
Here I will create a TFS project for the Accounts payable system. The project will contain all the necessary solutions, data, etc. for the entire system. Fill out the information and click Next:
The default is the agile template, but you can also select the CMMI template. For more information on the template type you can get more detailed instructions on MSDN. If you are using an agile approach (such as TDD), this is a good choice. After selecting, click Finish.
There will be various status updates during the project creation process.
After successful, click the Close button:
Team Explorer shows the project, which will contain work items, build, and source control:
The project collection can be updated at this time. Add a solution to TFS: Right-click the project in Solution Explorer and select Add Solution to Source control:
You can create a new folder for your solution in TFS or just use the default values. If you are ready, please click OK.
You can see in Solution Explorer that all files are already under source control. (View the "+" number in front of the file)
You can see the actions listed in the source code manager that you can take to expose the solution. Add a comment and click Check in:
Click Yes to confirm check-in.
At this point the new solution is in TFS, and the work item can be started.
Work Item
You can create projects directly in Visual Studio using Team Explorer or through the front end of the Web page and the test and Lab management tools. Open the Team Explorer and expand the queries item under the work item to browse your project. You can also browse any item you can see by double-clicking any query options (such as Active Bugs).
Because our TFS project is empty, there are no active bugs in the list.
Create a new Bug, select Menu: Team, create new project item. Here you can create a variety of work items to track function points, bugs, and so on. Select Bug to continue:
Fill in the relevant data for this new bug, and then click Save Project to submit to the database.
If you refresh the active bug query list now, you will see this new bug:
Now add a real bug to fix our project. In my case, I just created a default Windows Forms application. To update the title:
Now we need to fix this bug. Return to Solution Explorer, select Form1.cs, and then select Check out for editing:
Click the "Check Out" button to determine:
Now there's a tick mark next to the file so you know it can be edited:
When you update the Text property of the main window, vs automatically checks out any dependent files:
Although this example is a Windows Forms application, it also supports all other solution/project types. Now that we're satisfied with the code churn, select the Pending Changes tab at the bottom of vs.
In this example, we fix a bug, so click on the "Work Item" icon button:
Select the Bug#6 to track our headline errors. We want to solve it through this check-in:
Add a comment and click Check in, then click "Yes" to confirm.
If you refresh the bug#6, you will see that the status has changed to Resolved and the history has been updated.
Note that the changeset (the set of source management changes) has been automatically added to the history record.
At this point, you'll need to continue creating and fixing bugs as you work.
other ways to access TFS
I mentioned earlier that there is no need to use VS to access TFS. We've done a lot of deep consolidation with TFS and other clients, such as Web pages and office. For example, I can connect to my server (8080 is the default port) through a Web browser, simply by using the name of the server: http://jlzb2rel:8080/tfs/
Now I can browse through my collection and project. If you choose the Accountspayable project we just created, and then click on the "Continue" button, you will see more information. In this example, you can find all the bugs in this system by navigating to the Work Items tab.
This is really a simple way to browse your project. Can be on any computer, and no additional items need to be installed. These operations also have relevant support in other software, such as Excel,microsoft project. This type of access makes it easier for all members of the project to work together.
At this point, you have a very useful tool to do the work easily. If you're using VSS, it's just that the content is exciting. Now you can drop this tutorial and rest will come back if you want to try some advanced properties, such as test scenarios. I will use Beta 1 to demonstrate in this tutorial.
Build Support
The next typical part of the workflow process is to generate products automatically. If you follow Brian's installation instructions, you now have TFS Basic local build support on your machine. The first step is to navigate to Team Explorer, right-click all build definitions, and select New build definition:
There are a series of definitions that need to be filled in like a Code Project's property page:
The trigger page allows us to decide when the build starts. You can choose from the following items:
• Manual items are used by default. We have to start our own generation with this.
• Continuous integration is useful every time you check in and you want to have a new build. It allows you to verify the new check-in immediately without having to wait for a lot of check-in to mix together.
• Rolling builds provide a way to batch change, which is handy when it takes a little time to start a build and you can't do every item.
• Gated check-in allows you to ensure that all check-in passes are generated before being passed into TFS. And make sure you don't create damage to other members of your project team.
• Planning students to be the whole team to do the daily build a useful try
You can create and use several different build definitions, allowing you to use different types of builds for different purposes.
You can view all the tags in your spare time (each item has a complete document description on the product). But we need to provide a location to generate a new build to address the yellow warning flag in the default build, where I created a public UNC on my machine:
You can now save the build definition to TFS. If you go back to Team Explorer, we can "get the new build into the queue":
In the Pop-up confirmation dialog box, select queue:
This is my machine. The Status page displays a queued build:
If you double-click a build in the queue, you get the detailed status of the build:
From here you can see warnings and errors, log files, navigate to the drop directory, and so on. For example, if you select "View Log File", you can see the script that executes the build (subset):
If you choose to open the Drop folder link, you will be brought to our drop location:
Now anyone can choose to generate to do their daily tests, or release them to customers.
At this point you already know everything with the basic configuration of TFS.
In the future, I'll do a tutorial on how to install a virtual lab system (part of the flagship Visual Studio) that enables you to deploy complex applications to the Hyper-V environment for automated testing.
Create a new TFS collection
[Note: This part is completely optional] if you like you can store all of your work in a TFS. If you are a visual Source safe user, you can skip this whole section. But if you want to create a new top-level collection, it's pretty straightforward. The first step is to start, then the team Infrastructure Management Console:
When the console starts, select Team Project collection items and click the Create Team project collection Link:
To fill in the name of the item you want to describe, click Next:
Accept the default values for the data tier, and then click Next:
The TFS basic configuration does not support lab management, so go directly to the next step:
Where all the required data is configured, you can choose to "verify":
This information is validated primarily for the successful creation of a collection:
When the verification is complete, click Create:
This step provides everything you need for each configuration of TFS. Click Next to complete the following:
You will see a default version of the new project set: