How to install .NET on SLES / openSUSE?

How to install .NET on SLES / open SUSE?

How To - A help section for how to do a task

Install .NET on your SLES or open SUSE

In order to install .NET on SLES or open SUSE, you will need to register Microsoft signature key & add Microsoft Product feed. This has to be done only once per machine.

Now open cmd (command prompt) or terminal and run the following commands:

~$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
~$ sudo sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl= https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/zypp/repos.d/dotnetdev.repo'

Now we will proceed towards installation of .NET SDK. To get started, update the products available for install & install components required for .NET installation. After this install .NET SDK using the following commands:

~$ sudo zypper update
~$ sudo zypper install libunwind libicu
~$ sudo zypper install dotnet-sdk-2.0.2

While installation of SDK, openSUSE & SUSE may report that libcurl is not provided. libcurl should be installed on supported versions of both Linux. You can execute the following command to confirm about libcurl, then press for Solution 2 to continue installing .NET.

~$ zypper search libcurl

Now you have to create your app. Close the command prompt and reopen it. Now, type the following commands:

~$ dotnet new console -o myApp
~$ cd myApp

The dotnet command will create the new app of console type. The -o parameter will create new folder or directory naming it myApp. Your app and its files will be stored here. To navigate to newly created folder myApp, you will use cd myApp command. There will be a file Program.cs in myApp folder which contains hello world code.

using System;

namespace myApp

{

class Program{

static void Main(string[] args){

Console.WriteLine("Hello World");

}

}

}

 

Now its time to run your app. To run your app, open your command prompt or terminal and write the following command and press enter to execute.

~$ dotnet run

 

Thanks for reading our tutorial. Check more!

Leave a Reply

Your email address will not be published. Required fields are marked *