How to Build and Deploy .NET Projects

How to Build and Deploy .NET Projects

This article will guide you through the process of introducing the Continuous Deployment approach to your .NET projects with Buddy and help you automate build and delivery activities.

In this guide, we’re using a C# website as an example, but you can use any .NET project as well.

Actions used in this guide:

Why you should actually read this guide

You know for sure the Agile approach, which aims to reduce the development cycle time to a minimum. The reason for that is obvious: the faster the software moves to the next stage of the development process, the faster you get the feedback and are able to deliver the improved version. With Buddy, you can streamline the whole process to a single push to the repository. Read on to learn how.

Image for post

The basic idea behind Buddy

Setting up a project and a Git repository

Working in Buddy is based on projects which are basically Git repositories with delivery pipelines attached. Let’s set up a project for your C# application and initialize the Git repository for that project.

Version control like Git it the very basis of the Continuous Delivery approach. If you’re not familiar with the concept, check our beginner’s guide to Git.

Create the project

To create a new project:

  1. Sign up at https://buddy.works with your Git provider or email address.
  2. Choose your Git provider.
  3. Select the repository with your .NET project.
Image for post

Creating Project

If you wish, you can use Buddy to host your code. The service offers a fully-featured Git hosting with merge requests and push permissions

Build the pipeline

A pipeline is a set of actions, executed automatically in the given order, and under the conditions defined by you. Let’s use it to introduce Continuous Delivery to your C# workflow:

  1. Click Add a new pipeline and enter the name of the pipeline.
  2. Enter the name of the pipeline, set the Trigger mode to On every push, and assign it to the branch that you want to deploy:
Image for post

Creating Pipeline

Configure the build action

Buddy uses isolated Docker containers for builds. They are essentially virtual machines with preconfigured dev environments (frameworks, dependencies, databases, etc.) To build the C# application we’ll use Mono, a cross-platform .NET framework.

You can read more about the concept of Docker containers in our guide on Docker basics.

  1. Select .NET from the list of actions.
  2. Enter your tasks in the command field. You can install missing dependencies in the Environment tab.

Once you add the action, Buddy will automatically build your application on every push to the selected branch.

Image for post

Adding Action

Configure the delivery

Your application is ready for the delivery. With Buddy, you can deploy both to FTP/SFTP server as well as cloud services like Azure, AWS, Google or Heroku.

In this case, we’ll use a simple FTP:

  1. Switch to the Actions tab of your pipeline and click +.
  2. Select the FTP action and enter the details of your server.

You can use environment variables to hide sensitive data.

Image for post

Adding Delivery Action

Buddy will check write permissions on your server by sending and removing a test file. If everything is correct, the action will be added to the pipeline.

Run the Pipeline

With the pipeline configured, let’s check how it all works. Make a push to the repository or click Run pipeline in the right column:

Image for post

Running Pipeline

From now on, Buddy will automatically build and deploy your app on every push to the selected branch.

Note:

  • On the first execution, Buddy will deploy all files from scratch (unless you set a specific revision on the server). From then on, only changed files will be deployed, which will significantly reduce the deployment time
  • The same applies to the build: on the first execution, Buddy will download and install all dependencies. With everything in place, the following builds will take much shorter to execute.

Originally published at buddy.works on February 2, 2017.