Set Up Your Dev Machine and Start Using Version Control
Are you ready to set up your dev machine to take advantage of all the benefits of a version-controlled codebase? If you work in a simple codebase structure without branches, you can do this in just a few minutes and then rarely think about your workspace again.
Tip
Is your codebase structure complex? Does your team work in multiple branches? If so, you might get better results if you create one or more workspaces and then optimize them to meet your needs.
Before you start
Before you start working in version control, you must:
Install Team Foundation Server. How?
Install Visual Studio on your dev box. How?
Create a team project (if you don’t already have one). How?
Create your workspace
Required permissions
You must be one of the Contributors for your team project. See Team Foundation Server Default Groups, Permissions, and Roles.
To create your workspace
In Windows, create the folder that will contain your code (including the solution, code projects, and the source code files). For example, this would be a good location for your folder: c:\code\SiteApp\.
In Visual Studio, in Team Explorer:
If you are not already connected to the team project that you want to work in, then connect to the team project.
Choose Home, and then choose Source Control Explorer.
In Source Control Explorer, navigate to your team project. Choose Not mapped.
Use the Map dialog box to map the root folder of your team project to the appropriate local folder. For example, you could map $/SiteApp to c:\code\siteapp.
The system prompts you to download the files in the folder you just mapped.
Choose Yes.
After the files are downloaded, you are ready go get busy coding, unless you are beginning work in a new team project. In this case, before you get started, read on for a simple tip about folder structure.
Develop your code in the “Main” parent folder
Are you starting to work in a new team project? Then take this simple step when you set up your version control folder structure, and you’ll be ready when your team grows large enough for you to need branches to manage your work. There are just a few steps, and you don’t even have to think about or understand branches right now (unless you want to).
Put all your code in a parent called Main (for example: $/SiteApp/Main/).
Required permissions
You must be one of the Contributors for your team project. See Team Foundation Server Default Groups, Permissions, and Roles.
To develop your code in the “Main” parent folder
On the menu bar choose View, Other Windows, Source Control Explorer.
In Source Control Explorer, select your team project in the left pane.
On the menu bar choose File, Source Control, New Folder.
Type Main and choose the Enter key.
Open the shortcut menu of the Main folder and choose Check in.
The Check-in Confirmation dialog box appears.
Select Don’t prompt again and choose Yes.
Your changeset is checked in.
Get busy building your app. Make sure to put your code (including solutions, code projects, source files) in the Main folder that you just created.
Next steps
Now that your workspace is set up, you are almost ready to begin developing code and writing tests.
If you don’t yet have one, create a new code project. In Visual Studio, on the menu bar choose File, New, Project.
Add your existing code to source control. How?
Download your team’s code into your workspace (if you did not already do so when you created your workspace). How?
Use Source Control Explorer to manage your files. How?
Optimize your workspace or create additional workspaces. How?