Learn .NET on Ubuntu in 30 Days

by Santhakumar Munuswamy

  Posted on  25 February 2019

  Ubuntu


 

In this article, we will discuss in details about .NET on Ubuntu, How to install the .NET SDK on Ubuntu 18.04, How to register Microsoft key for the first time on Ubuntu, How to create Hello World apps, How to create a new web app, How to create a new class library project, How to build and run the app and etc.

In this article, we will see the following

  • How to register Microsoft key for the first time on Ubuntu
  • How to install the .NET SDK on Ubuntu 18.04
  • How to create a new console app
  • How to create a new web app
  • How to create a new class library project
  • How to build and run the app
Prerequisite

  • Ubuntu 18.04
  • dotnet-sdk-2.2

How to register Microsoft key for the first time on Ubuntu 18.04

You can download and install the .NET SDK to Ubuntu 18.04 machine. Suppose, if you are going to install the .NET SDK for the first time in your machine, then you have to register the Microsoft Key and repository with including required dependencies on it. 

  • Open Terminal Window
  • Copy and paste the following command in Terminal Window, then Enter

wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb


How to install the .NET SDK on Ubuntu 18.04

You can learn in this section, how to install the .NET SDK on Ubuntu 18.04 as the following instructions. 

  • Open Terminal Window
  • Copy and paste the following command in Terminal Window, then Enter

sudo add-apt-repository universe


  • Copy and paste the following command in Terminal Window, then Enter

sudo apt-get install apt-transport-https


  • Copy and paste the following command in Terminal Window, then Enter

sudo apt-get update


  • Copy and paste the following command in Terminal Window, then Enter

sudo apt-get install dotnet-sdk-2.2




How to create a new console app

You can learn in this section, how to create a new console application on Ubuntu environment as the following instructions.

  • Open Terminal Window
  • Copy and paste the following command in Terminal Window, then Enter

dotnet new console -o HelloWorldApps 


  • Copy and paste the following command in Terminal Window, then Enter

cd HelloWorldApps

dotnet run


How to create a new web app

You can learn in this section, how to create a new web application on the Ubuntu environment as the following instructions.

  • Open Terminal Window
  • Copy and paste the following command in Terminal Window, then Enter

 dotnet new webApp -o myWebApp


  • Copy and paste the following command in Terminal Window, then Enter

cd myWebApp

dotnet run




How to create a new class library project

You can learn in this section, how to create a new class library project on Ubuntu environment as the following instructions.

  • Open Terminal Window
  • Copy and paste the following command in Terminal Window, then Enter

dotnet new classlib -o SampleLibrary


You can see now SampleLibrary project structure as the following screenshot


  • Copy and paste the following command in Terminal Window, then Enter

Cd SampleLibrary

dotnet build


How to build and run the app

You can learn in this section, how to build and run the app on Ubuntu environment as the following instructions.

  • Open Terminal Window
  • Copy and paste the following command in Terminal Window, then Enter

dotnet build

dotnet run

Reference

  • https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/intro

Conclusion
I hope you understand now about .NET on UbuntuHow to install the .NET SDK on Ubuntu 18.04, How to register Microsoft key for the first time on Ubuntu, How to create Hello World apps, How to create a new web app, How to create a new class library project, How to build and run the app and etc. I have covered all the required things. If you find anything missing, please let me know.
Please share your valuable comments or feedback to improve my future articles. :)

 


About the Author
Santhakumar Munuswamy is a seasoned Solution Architect and Most Valuable Professional in Cloud /AI solutions. He has been experienced around 14 years in Solution designing, Software Product Development, Technical Documentation, Project Management for Web and Cloud Applications. He has experience in the IT industry across different domains (Automotive, Telecommunications, Healthcare, Logistics & Warehouse Automation, etc.) with roles in Technical Architect, Genesys Consultant, Technical Lead, Team Lead, and Developer. He has experienced in mentorship and coaching high potential developers.

Follow Me: Facebook, Twitter, Google Plus, LinkedIn
blog comments powered by Disqus


Month List

Community Badges