One of the main advantages of using .NET Core Web API is the speed in transaction processing. In this tutorial, we will execute a .NET Core Web API 2.2 application using MonoDevelop as an IDE on Ubuntu 18.04.
Introduction
In this article, let us see how to install Mono Framework, MonoDevelop, and use it with .NET Core, by creating a new project (Web API) in MonoDevelop.
Step 1 - Installing Mono Framework
In Ubuntu, open the CMD and run the following command.
- sudo apt-key adv --keyserver hkp:
- echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
- sudo apt update
- sudo apt install mono-devel
- mono --version
This command will return the Mono 5.18 version details that confirm that the framework has been installed. (Now, you can build C# apps on Linux (GTK#, ASP.NET Web Forms, ASP.NET Web Services, Console Applications, etc).
Step 2 - Installing MonoDevelop (IDE)
Open the CMD and run the following command
- sudo apt install apt-transport-https dirmngr
- sudo apt-key adv --keyserver hkp:
- echo "deb https://download.mono-project.com/repo/ubuntu vs-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-vs.list
- sudo apt update
- sudo apt-get install monodevelop
Now, you can build C# Apps using MonoDevelop IDE on Ubuntu 18.04.
Step 3 - Installing .NET Core 2.2
Open the CMD and run the following command
- wget -q https:
- sudo dpkg -i packages-microsoft-prod.deb
- sudo add-apt-repository universe
- sudo apt-get install apt-transport-https
- sudo apt-get update
- sudo apt-get install dotnet-sdk-2.2
- dotnet –version
This command will return the .NET Core 2.2 version details that confirm that the tool has been installed.
Now, you can build the first .NET Core 2.2 Web API in MonoDevelop on Ubuntu 18.04. Open MonoDevelop IDE in the Ubuntu Apps Dashboard.
Step 4 - Create .NET Core Web API in MonoDevelop
First, click and create a new Project.
Now, select “ASP.NET Core Web API” and click the "Next" button.
Put some names in the required fields and click "Create".
You can see a .NET Core Web API tree solution.
Select Program.cs and add the following code.
Double-click the solution name, that will open Options window. Select Run -> Default Option and put the following port number.
Done. Now, run the program and check it in a web browser. The .NET Core Web API is ready.
Summary
This tutorial showed how to install and create a .NET Core Web API 2.2 in MonoDevelop on Ubuntu 18.04.