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.

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

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 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 loading...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.

Hint
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 loading...Creating Project

Hint
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 loading...Creating Pipeline

Configure the build action

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

Hint
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 loading...Adding Action

Configure the delivery

Your application is ready for the delivery. With Buddy, you can deploy both to FTP/SFTP server as well 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.
Tip
You can use environment variables to hide sensitive data.

Image loading...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 loading...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.
Jarek Dylewski

Jarek Dylewski

Customer Support

A journalist and an SEO specialist trying to find himself in the unforgiving world of coders. Gamer, a non-fiction literature fan and obsessive carnivore. Jarek uses his talents to convert the programming lingo into a cohesive and approachable narration.