Hands-on Azure Repos: Understanding Centralized and Distributed Version Control in Azure DevOps Services
()
About this ebook
You'll start with an introduction to Azure Repos, focusing on TFVC and Git, and then gradually transition to hands on lessons of working with TVFC. Next, you'll see how to set up and work with TFVC branches and tracking systems followed by usage of command line and security in TFVC Repos.
Create and work on Git Repos in Azure DevOps and use branching with Azure Git Repos and Git command line in Visual Studio and vscode. The book then explores security in Git Repos and advanced options you can use to import from external Repos. With Hands-on Azure Repos as your guide, you'll be able to work with these version control tools on any platform and with any language.
What You'll Learn
- Integrate Azure Repos with Azure Boards to enable tracking work with code.
- Create guidelines to tackle difficult situations in using Azure Repos
- Clone Azure Repo to local using Visual Studio and vscode
- Work with shelvesets, code reviews and lock types
- Perform activities using REST API with Azure Repos
Software developers, tech leads and architects.
Read more from Chaminda Chandrasekara
Hands-on GitHub Actions: Implement CI/CD with GitHub Action Workflows for Your Applications Rating: 0 out of 5 stars0 ratingsHands-on Azure Pipelines: Understanding Continuous Integration and Deployment in Azure DevOps Rating: 0 out of 5 stars0 ratingsHands-On Functional Test Automation: With Visual Studio 2017 and Selenium Rating: 0 out of 5 stars0 ratingsHands-on Azure Boards: Configuring and Customizing Process Workflows in Azure DevOps Services Rating: 0 out of 5 stars0 ratings
Related to Hands-on Azure Repos
Related ebooks
Learning DevOps: A comprehensive guide to accelerating DevOps culture adoption with Terraform, Azure DevOps, Kubernetes, and Jenkins Rating: 0 out of 5 stars0 ratingsMigrating a Two-Tier Application to Azure: A Hands-on Walkthrough of Azure Infrastructure, Platform, and Container Services Rating: 0 out of 5 stars0 ratingsAzure DevOps for Web Developers: Streamlined Application Development Using Azure DevOps Features Rating: 0 out of 5 stars0 ratingsThe Complete ASP.NET Core 3 API Tutorial: Hands-On Building, Testing, and Deploying Rating: 0 out of 5 stars0 ratingsProtocol Buffers Handbook: Getting deeper into Protobuf internals and its usage Rating: 0 out of 5 stars0 ratingsAgile Project Management with Azure DevOps: Concepts, Templates, and Metrics Rating: 0 out of 5 stars0 ratingsModern DevOps Practices: Implement, secure, and manage applications on the public cloud by leveraging cutting-edge tools Rating: 0 out of 5 stars0 ratingsBuilding REST APIs with Flask: Create Python Web Services with MySQL Rating: 0 out of 5 stars0 ratingsMastering Ubuntu Server.: Master the art of deploying, configuring, managing, and troubleshooting Ubuntu Server 18.04 Rating: 0 out of 5 stars0 ratingsAzure Stack Hub Demystified: Building hybrid cloud, IaaS, and PaaS solutions Rating: 0 out of 5 stars0 ratingsLearning Azure DevOps Rating: 0 out of 5 stars0 ratingsLearning Azure DevOps: Outperform DevOps using Azure Pipelines, Artifacts, Boards, Azure CLI, Test Plans and Repos Rating: 0 out of 5 stars0 ratingsDeep-Dive Terraform on Azure: Automated Delivery and Deployment of Azure Solutions Rating: 0 out of 5 stars0 ratingsInfrastructure as Code for Beginners: Deploy and manage your cloud-based services with Terraform and Ansible Rating: 0 out of 5 stars0 ratingsRed Hat Certified Engineer (RHCE) Study Guide: Ansible Automation for the Red Hat Enterprise Linux 8 Exam (EX294) Rating: 0 out of 5 stars0 ratingsPro ASP.NET MVC 5 Platform Rating: 0 out of 5 stars0 ratingsOptimizing Visual Studio Code for Python Development: Developing More Efficient and Effective Programs in Python Rating: 0 out of 5 stars0 ratingsHands-On Python for DevOps: Leverage Python's native libraries to streamline your workflow and save time with automation Rating: 0 out of 5 stars0 ratingsReact and Libraries: Your Complete Guide to the React Ecosystem Rating: 0 out of 5 stars0 ratingsPractical DevOps: Implement DevOps in your organization by effectively building, deploying, testing, and monitoring code Rating: 0 out of 5 stars0 ratingsGetting Started with Terraform Rating: 0 out of 5 stars0 ratingsDevSecOps for .NET Core: Securing Modern Software Applications Rating: 0 out of 5 stars0 ratingsMastering GitHub Actions: Advance your automation skills with the latest techniques for software integration and deployment Rating: 0 out of 5 stars0 ratingsThe Linux DevOps Handbook: Customize and scale your Linux distributions to accelerate your DevOps workflow Rating: 0 out of 5 stars0 ratings
Programming For You
Excel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsHTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5JavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5C# Programming from Zero to Proficiency (Beginner): C# from Zero to Proficiency, #2 Rating: 0 out of 5 stars0 ratingsPython QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsC Programming For Beginners: The Simple Guide to Learning C Programming Language Fast! Rating: 5 out of 5 stars5/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5HTML in 30 Pages Rating: 5 out of 5 stars5/5SQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5Coding with JavaScript For Dummies Rating: 0 out of 5 stars0 ratingsBeginning Programming with C++ For Dummies Rating: 4 out of 5 stars4/5
Reviews for Hands-on Azure Repos
0 ratings0 reviews
Book preview
Hands-on Azure Repos - Chaminda Chandrasekara
© Chaminda Chandrasekara and Pushpa Herath 2020
C. Chandrasekara, P. HerathHands-on Azure Reposhttps://doi.org/10.1007/978-1-4842-5425-7_1
1. Getting Started with Azure Team Foundation Version Control
Chaminda Chandrasekara¹ and Pushpa Herath²
(1)
Colombo, Sri Lanka
(2)
Hanguranketha, Sri Lanka
Team Foundation Version Control (TFVC) is a centralized version control system for your source code management. Generally, a team member will have one version of each source code file on their machine while using TFVC. Branches of source code are based on paths and get created on the server. A history of version control is maintained on the source control server, not on the local developer machine. In TFVC you can apply permissions at a granular level, and restrictions can be applied at the file level, which we will discuss in Chapter 6.
In this chapter, we will explore the steps required to get started with TFVC in Azure DevOps using Visual Studio. You will be able to understand how to set up a team project to use TFVC or add a TFVC repo to an existing team project that is currently using Git repos. The steps required to set up your machine to develop with TFVC using Visual Studio will be described, and you will learn how to add new or existing solutions to TFVC in Visual Studio. Further, this chapter will discuss the different workspaces available in TFVC and the options to define and use code check-in (commit) policies. In addition, using TFVC with other developer tools such as VS Code and Eclipse will be described for you to get started even faster.
Lesson 1-1: Creating a Team Project with TFVC and Adding a TFVC Repo to the Existing Team Project
We discussed how to create a new team project in Chapter 1 of the first book, Hands-on Azure Boards, of this book series. However, let’s take a quick look at creating a team project with TFVC in this lesson to keep your experience seamless.
Prerequisites: You have an Azure DevOps organization created, and you have some experience working with Azure DevOps to create team projects, or you have followed the lessons in Chapter 1 of the book Hands-on Azure Boards.
Navigate to your Azure DevOps organization’s home page and click the Create project
button in the top-right corner. See Figure 1-1.
Figure 1-1
Creating project
In the team project creation pane, provide a name and select TFVC as the version control system. You can set Work item process
to whatever you’d like, as discussed in detail in the Hands-On Azure Boards book. See Figure 1-2.
Figure 1-2
Creating a team project with TFVC
The created team project has TFVC set as the repo by default, and you can view it by clicking the Repos menu option in the left menu. See Figure 1-3.
../images/483399_1_En_1_Chapter/483399_1_En_1_Fig3_HTML.jpgFigure 1-3
TFVC repo
Now, let’s look at how we can add a TFVC repo to an existing team project. Unlike Git where multiple Git repos can be added to a single team project, you can have only one TFVC repo per team project in Azure DevOps. Create a new team project with Git as the version control system. Then navigate to Repos in the left menu. On the Repos tab, click the drop-down next to the Git repo name and click New repository.
See Figure 1-4.
Figure 1-4
Creating a new repo in an existing project
In the dialog that appears, select TFVC as the repo type and click Create to create a new TFVC repo in a team project that already has Git repos. See Figure 1-5.
../images/483399_1_En_1_Chapter/483399_1_En_1_Fig5_HTML.jpgFigure 1-5
Creating a TFVC repo
In this lesson, we explored how to create a TFVC repo in an existing team project or create a new team project with TFVC as the source control system.
Lesson 1-2: Using Visual Studio Team Explorer
We created a new team project in the previous lesson with TFVC as the source control system. As a next step, we need to connect it to Visual Studio to get started with the source code development. In this lesson, let’s discuss the steps required to get Visual Studio connected to your newly created team project in the TFVC repository, using the Team Explorer window in Visual Studio.
Prerequisites: You have Visual Studio 2019 installed on your machine and are familiar with working with Visual Studio. You have followed the steps in Lesson 1-1 of this chapter and have a team project created with TFVC as the source control system.
In Visual Studio, to open Team Explorer, you can click View ➤ Team Explorer in the menu or press Ctrl+\ and then Ctrl+M. The Team Explorer window lets you connect to Azure DevOps. You can click the Manage Connection toolbar icon to go to the Manage Connections page of the Team Explorer window. See Figure 1-6.
../images/483399_1_En_1_Chapter/483399_1_En_1_Fig6_HTML.jpgFigure 1-6
Managing connections in Team Explorer
Click the Connect link or click the drop-down next to the Manage Connections link (see Figure 1-6) and then click Connect to a project.
In Team Explorer, the Manage Connection page will open as a pop-up window. In the Connect to a Project dialog, you can see the Azure DevOps organizations you have access to if you have already logged in to Visual Studio with a Microsoft account or your organization’s account. You can click Add an account
or select a different account if you have connected more than one account. See Figure 1-7. If you click Add an account,
you will be prompted for your credentials, and you can provide them to connect your Microsoft account or your organization’s account to Visual Studio.
Figure 1-7
Adding or selecting an account
Log on from the account you used to create a team project in the previous lesson and expand the Azure DevOps services organization to view your team projects and repositories. If you are using an on-premises Azure DevOps server, you have the option to provide an Azure DevOps server URL and connect it. In the expanded view, select the TFVC repo you want to connect and click the Connect button. See Figure 1-8.
../images/483399_1_En_1_Chapter/483399_1_En_1_Fig8_HTML.jpgFigure 1-8
Connecting a TFVC repo
Once the team project TFVC repo is connected, Team Explorer will allow you to map the TFVC path of the project to a local folder and create a workspace. There are two types of workspaces, and we will discuss them in Lesson 1-4. Provide a desired local path and click the Map & Get button. See Figure 1-9.
../images/483399_1_En_1_Chapter/483399_1_En_1_Fig9_HTML.jpgFigure 1-9
Map & Get button
In this lesson, we discussed the steps required to connect and map a local path for a TFVC repository using Visual Studio.
Lesson 1-3: Adding New/Existing Solutions to TFVC
Once we map the TFVC repository in Visual Studio, we are allowed to add new solutions to version control using the Solution Explorer window of Visual Studio. Let’s look at the steps to add a new solution to TFVC and how you can add an existing solution to TFVC using the Solution Explorer window of Visual Studio.
Prerequisites: You performed the steps described in the first two lessons in this chapter.
In Team Explorer, you will see the New link, which allows you to create a new solution. Click it. See Figure 1-10.
../images/483399_1_En_1_Chapter/483399_1_En_1_Fig10_HTML.jpgFigure 1-10
Creating a new solution
Then in the Create a new project
dialog, search for console application, select the .NET Framework console application, and click Next. See Figure 1-11.
Figure 1-11
Creating a console application
In the next step, provide a name for the project. Do not change the Location path as the new solution is already being created in the mapped path of TFVC. Click Create to create the new application. See Figure 1-12.
../images/483399_1_En_1_Chapter/483399_1_En_1_Fig12_HTML.jpgFigure 1-12
Creating the console application in the mapped source path
Once the new solution is created, view it in the Solution Explorer window of Visual Studio. You can open Solution Explorer by pressing Ctrl+Alt+L or by clicking View ➤ Solution Explorer in the Visual Studio menu. If you have an existing solution that you need to add to TFVC, copy all the content of the solution to the mapped local drive path of TFVC and then open that solution in Visual Studio. Once you create/open a solution in Visual Studio, go to the Solution Explorer window and right-click the solution you want to add to TFVC. Then click Add Solution to Source Control in the context menu. See Figure 1-13.
../images/483399_1_En_1_Chapter/483399_1_En_1_Fig13_HTML.jpgFigure 1-13
Adding the solution to source control
You will notice that all the files in the solution are marked with a +, indicating that they are ready to be checked in (committed) to TFVC. See Figure 1-14.
../images/483399_1_En_1_Chapter/483399_1_En_1_Fig14_HTML.jpgFigure 1-14
Solution ready to be checked in
Next open the Team Explorer window and click Pending Changes. In the Pending Changes window of Team Explorer, you will be able to see the new solution files are ready to be checked in. You can provide a comment and check in your code to TFVC. Further, you can see the Related Work Items options allowing you to add a work item, which we will discuss in Chapter 2. Note that there are some local file changes detected (this is because of the default local workspace; we will discuss the difference between the server and local workspaces that are available for TFVC in Lesson 1-4). See Figure 1-15.
../images/483399_1_En_1_Chapter/483399_1_En_1_Fig15_HTML.jpgFigure 1-15
Pending changes
Click the detected changes in the Excluded Changes section. A dialog will appear, and you will be able to see the local files that should be ignored by source control. Select all the files and right-click to open a context menu. In this window, you are allowed to promote files, which will be included as changes. Or you can ignore local-only files. Since