Leveraging Microsoft TFS 2015 Update-3 for .NET (Build, Testing, and Deployment): A TFS Guide
TFS is widely used for .NET development facilitated by the Visual Studio .NET IDE. TFS 2015 Update 3 allows connection to any Team Foundation Server Git repository using an SSH key.
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
Team Foundation Server (TFS), a Microsoft ALM product, provides exhaustive features for all-inclusive development and testing. It covers functionalities like Work Item Management, Project Planning (Waterfall or Scrum), Version Control, Build/Release (Deployment), and Testing.
NOTE: As this TFS guide features numerous images, please ensure that it loads correctly.
Also, you might want to explore: TFS for JAVA Projects with Eclipse in DevOps
Table of Contents:
Introduction
While TFS is primarily constructed for Microsoft Visual Studio and Eclipse, it can also serve as a backend for a variety of other Integrated Development Environments (IDEs).
In this section, we’ll show how Team Foundation Server (TFS) can be harnessed to automate the Build, Testing, and Deployment of .NET Web Applications, one of the tool’s main advantages.
Requirements:
- Microsoft TFS 2015 Update 3
- Microsoft Visual Studio .NET 2015 (30-day trial version)
- SonarQube 6.4 or higher
- IIS Web Server activated. If you are using Windows 7, refer to this tutorial to enable IIS 7.
- Several YouTube tutorials are available to enable IIS on Windows 2008 / 2012 / 2016.
To execute the steps outlined in this tutorial, a Build Server for performing the Builds and Deployment machines or environments for deploying the applications to IIS with agents in operation will be necessary. You can refer to my previous tutorial on how to install agents.
Setting Up a C# Application
Assuming TASK work items are already created in TFS and assigned to developers, it’s crucial to maintain traceability throughout the software lifecycle.
Before integrating a .NET application into the TFS source control repository, ensure that a Collection and Team Project have been established.
The TFS Administrator generates a Collection, which encompasses a group of Team Projects executed in any service organization. Individual collections can be created in TFS for each customer’s projects.
Once a collection has been established, multiple team projects can be developed within it. A team project encompasses all work items, source code, test artifacts, metrics for reports, etc. Team projects can be created utilizing various inbuilt process templates such as Scrum, Agile, CMMI, and so on.
- Further information on generating collections can be found here.
- In this example, we will use the Default Collection created upon TFS installation.
- Follow the steps displayed below to create a team project within a collection.
Access the TFS Web interface using the following URL: http://<ServerName>:port/tfs
and the created project will be visible.
Now that a collection and a team project have been set up, let’s initiate Visual Studio .NET, develop a new C# Web application, and share the project with the TFS source control repository. This is the initial step towards embracing Continuous Integration (CI) practice.
Step 1: Launch Visual Studio .NET and designate TFS as the default source control repository. Navigate to Tools => Options => Source Control. Then select OK.
Step 2: Navigate to View => Team Explorer and establish a connection with the TFS server using the icon
Step 3: Create a C# ASP.NET Web project
Step 4: Select the Web Forms template
Step 5: Add the solution to TFS source control repository
Conventionally, the steps mentioned above necessitate a Build Server to perform the tasks along with Deployment machines or environments where the applications will be allocated to IIS with agents installed and operational. Please refer to my previous tutorial for a guide on agent installation.
Establishing Build Definition with Code Analysis
A build definition consists of a sequence of tasks performed during an automated build process. These tasks can include operations like running a Visual Studio Build, MS Build, executing PowerShell or Shell scripts, among others.
Step 1: To establish a Build Definition, sign in to the TFS web interface and proceed to the Builds TAB. Select the “+” button to formulate a build definition. Start with an EMPTY definition and then select Next.
Step 2: Choose the Team Project and select Create
Step 3: Revise the Build Definition and save it as “Main Build”
Step 4: Include the tasks – SonarQube Scanner for MSBuild – Begin Analysis and SonarQube Scanner for MSBuild – End Analysis
Step 5: Set up the Begin Analysis task with the SonarQube server specifications
Step 6: Arrange the End Analysis step
Step 7: Include a Publish Artifacts task to save the artifacts in a drop folder on the server
Step 8: Install the agent on the Build and Deployment machine
Step 9: Verify that the SonarQube SCM TFVC plugin is downloaded and duplicated to the SonarQube installation extension plugins directory
Step 10: Start the Sonar server
Step 11: Kick off a Build to verify the task’s efficiency
The build should be triumphant and all the steps should operate seamlessly.
Generating Release for Deployment
A Release is formulated to automate the deployment of the artifacts from the “drop” folder to IIS.
Step 1: Navigate to the Release hub and create a Release Definition
Step 2: Start with an Empty definition and save it
Step 3: Link the Build definition to the Release definition
Step 4: Activate the Trigger for deployment after a successful build is available
Step 5: Include tasks to deploy the artifacts to the IIS server. For