How to install Visual Studio Code and .NET Core on RHEL 7

Visual Studio Code

Introduction

It was November 2014 when Microsoft announced the open sourcing of .NET with a project named .NET Core. It was announced as a smaller set of the .NET Framework, with many of the same APIs, and including “runtime, framework, compiler and tools components that support a variety of operating systems and chip targets” as stated in MSDN. This was an important announcement because .NET is a widely-used general development platform.
One year later, Red Hat and Microsoft announced a collaboration which resulted in access to .NET on Red Hat Enterprise Linux and Red Hat OpenShift.

In June 2016, Red Hat announced that .NET would be available via the integrated hybrid support partnership between both companies, making “Red Hat the only commercial Linux distribution to feature full, enterprise-grade support for .NET, opening up platform choice for enterprises seeking to use .NET on a flexible Linux and container-based environments.”

Enable .NET Core repositories

If you use RHEL 7 for development, you should have a subscription as a developer (at no-cost through the Red Hat Developer Toolset).

So, check it with:
# subscription-manager repos –list | egrep dotnet

If there are repositories listed, it means that .NET can be installed. So, enable the repo:

# subscription-manager repos --enable=rhel-7-server-dotnet-rpms

Install .NET Core

Once the repository is enabled, it’s possible to install .NET with yum. Just:

# yum install rh-dotnetcore11

Working with .NET Core

The .NET Core packages are designed to allow multiple versions of software to be installed concurrently. To allow this, every package is added to the runtime environment with the command scl enable. When running, it environment variables and then runs the specified command. Its changes only affect the command that is run by scl and processes that are run from that command. This helps in maintaining a “clean” environment.

So, in a new terminal window, as user, execute the command:

$ scl enable rh-dotnetcore11 bash

This will start a new Bash instance, which has access to .NET Core 1.1 (the one installed previously).
Execute:

dotnet --version

for checking if everything works.
Now, just executing the exit command will shut down .NET and return to a “normal” Bash.

Install Visual Studio Code

GNU/Linux systems have a lot of text editors and IDEs, so anyone can use the tool he likes the most for writing code.
But, in the case of .NET Core and C#, a good option could be Visual Studio Code, the open source editor written by Microsoft.
To install the 64-bit code editor on Red Hat Enterprise Linux 7, execute the following steps:

First, set up the yum repository as follows:

# rpm --import https://packages.microsoft.com/keys/microsoft.asc
# sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'

Next, update the package cache and install Visual Studio with:

# yum check-update
# yum install code

Using Visual Studio Code with .NET Core

Using scl start the editor with .NET Core. The syntax is the same as the “Bash example”:

$ scl enable rh-dotnetcore11 code

Click on File->Open Folder and open the folder in which the Hello World program will be saved; Visual Studio Code will ask to install a C# extension. Do it.
Next, open the integrated terminal from Visual Studio Code by typing CTRL+\, as suggested in the Welcome page of the editor.
There, execute:

$ dotnet new

This will create two files: Program.cs and package.json. Open the first one by clicking on it in the left sidebar, and it should contain a simple Hello World program. Probably the editor would suggest to solve some dependency; just click on Yes and wait.
For running the program, open the integrated terminal and execute:

$ dotnet run

And that’s all that is needed to start working with .NET Core and Visual Studio Code on Red Hat Enterprise Linux 7!

14 COMMENTS

  1. I have profited 104,000 thousand dollars in last twelve months by working from my house a­n­d I did it by work­ing in my own time for 3 or sometimes more h /day. I was following a money making opportunity I came across from company that i found online and I am so amazed that i made so much extra income. It’s newbie-friendly and I’m just so happy that i discovered it. This is what i did… http://urlof­.­site/TnQVc

  2. I was paid 104000 dollars past year by doing an internet job moreover I was able to do it by w­orking in my own time f­o­r several hours each day. I applied job opportunity I came across on the web and also I am thrilled that I was capable of to earn such decent money. It’s genuinely newbie-friendly and therefore I’m so grateful that I discovered out regarding it. Find out more about what I do… I was without work for 6 months when my early Fellow worker lastly suggested me to start off freelancing from home… That was really after I received $5000 in my first thirty days when I really believed I could do this for a living! At the moment I am delightful than ever… I work-at-home and also I am my own boss now that I always wanted… I see so many discouraged people around me, working the same old boring job that is sucking the daily life out of them day-after-day… Everytime I see anybody like that I say START FREELANCING MAN! This is how I started off >>>> www­.­cat­.­org­.­uk/snip/78276

  3. I was paid 104000 dollars previous 12 months by doing a web-based task as well as I was able to do it by w­orking in my own time f­o­r several hours on a daily basis. I tried job opportunity I found on the web and therefore I am delighted that I was manage to earn such decent cash. It is seriously newbie-friendly and therefore I am so grateful that I found out about it. Check out exactly what I do… www­.­cat­.­org­.­uk/snip/93439

  4. I was paid 104000 dollars last 12 months by doing an online job and I was able to do it by w­orking in my own time f­o­r several hours on a daily basis. I utilized work opportunity I found out on the internet and also I am delighted that I was capable to earn such great money. It is really newbie-friendly and I’m so grateful that I discovered out about it. Find out more about what I do… http://polr­.­me/1g1h

  5. I was paid 104000 dollars previous 12 month period by doing an internet based task moreover I was able to do it by w­orking in my own time f­o­r quite a few hours during the day. I tried job opportunity I came across on-line and also I am thrilled that I was able to earn such good money. It’s seriously newbie-friendly and I’m so blessed that I discovered out regarding it. Look out for exactly what I do… http://urll­.­in/3RN3g

  6. I was paid 104000 bucks past 12 months by doing an online work and also I was able to do it by w­orking in my own time f­o­r several hours on a regular basis. I utilized work opportunity I stumbled upon over the internet and so I am delighted that I was capable of to make such great money. It’s actually newbie-friendly and I’m so delighted that I discovered out regarding it. Look into what I do… http://ipt­.­pw/I7AzSb

  7. I was without work for six months when my former Fellow worker eventually strongly recommended me to start freelancing online… It was actually after I earned $5000 in my initial thirty days when I seriously believed I could do this for a living! Now a days I am delightful than ever… I work at home as well as I am my own boss now like I always wanted… I see a lot of unsatisfied people around me, working the same old boring job that is sucking the life from all of them day-after-day… Each time I notice any person like that I say START FREELANCING MAN! This is where I started off >>>> http://flicom­.­ru/846246

  8. I was paid 104000 dollars past 12 months by doing a web based job and also I was able to do it by w­orking in my own time f­o­r quite a few hours everyday. I tried job opportunity I found out on the web and so I am thrilled that I was manage to earn such decent money. It is undoubtedly newbie-friendly and therefore I’m so delighted that I found out about it. Read through what I do… http://olaurl­.­com/15cq7

  9. Chief of Yahoo!, is giving advice consumers to get started in “Work at home” method, that I have already been doing for over 12 months now. This season only, I generated approximately $36k so far with nothing but my laptop or computer as well as some leisure time, however i have a full-time nine to 5 job. Even everyone not used to this, can earn $50/per h successfully and the income might be much higher over a period of time… This is how i started >> http://adultadda­.­net/2Y4

  10. M­a­n­y p­e­o­ple w­a­nt t­o ha­v­e a passive in­com­e at their, bu­t t­he­y don’t have much idea ho­w t­o exactly d­o th­at o­n th­e Int­ernet. Th­ere ar­e a many w­ays t­o ea­rn large am­ount of mo­ney, b­ut wh­enev­er p­eopl­e t­ry th­at the­y g­et tr­app­ed in a s­cam, Therefore I am sh­aring wi­th yo­u a g­enuine an­d gu­arante­ed w­ay f­or fre­e to ea­rn hug­e am­ount of mon­ey a­t ho­me.I am earning atleast $10000 per month since 1 year.Its an online work and really easy to do, Even a little child can do this job and make online money. If you want a happy and wealthy life then you need to copy and paste this website in browser and then follow instructions to get started today and earn Thousands Using the internet……….. http://ipt­.­pw/kiEID9

  11. M­a­n­y p­e­o­ple w­a­nt t­o ha­v­e a go­o­d in­com­e at h­o­me, bu­t t­he­y don’t have much idea ho­w t­o exactly d­o th­at o­n th­e Int­ernet. Th­ere ar­e a a number of w­ays t­o ea­rn massive am­ount of mo­ney, b­ut wh­enev­er p­eopl­e t­ry th­at the­y g­et tr­app­ed in a s­cam, Thus I am sh­aring wi­th yo­u a g­enuine an­d gu­arante­ed w­ay f­or fre­e to ea­rn hug­e am­ount of mon­ey a­t ho­me.I am earning atleast $10000 on a monthly basis since 12 months.Its an internet work and pretty easy to do, Even a little child can do this work and make money. If you want a happy and rich life then you need to copy and paste this web site in web browser and then follow instructions to get started today and make Thousands Over the internet……….. http://v15­.­uk/96i5Z

  12. If you seeking for genuine online earning advertising opportunity and you are sick and tired with online scammers in that case this is actually what you need. I started off working on this job two yrs back and earning Seven Thousand dollars or even more each and every month effortlessly. Start earning funds same as me… Take a look at website >>>>>>>>>>> http://v15­.­uk/UhY2n

  13. Generating revenue by going online is as trouble free (or sometimes as very difficult) quite as getting you a good return off-line. Even though tons of Marketing specialists declare to possess a undisclosed method to generate fast earnings, the truth is, you will not have any system you will be able to become rich over-night by means of clicking a button or simply acquiring a couple of course. Making profits online does need some hard work and motivation. Whenever you are prepared for invest sufficient time and consequently effort into it, you will discover numerous means to getting large paycheck online.I am gaining $10 thousand or even more month-to-month from this gig.Here’s the procedure to earn though the rest are very long money making ideas >>>>> OUOURL.COM/4rg3

  14. I initiated freelancing over world wide web, through doing some basic tasks which primarily demanded a computer and consequently access to net and additionally Now I am satisfied than ever before… six months time get gone by since i started out this and therefore i received cash total of $36,000… Basically I make eighty usd each hour and even work for 3 to four hrs most of the days.And beauty of this is that you can organize time whenever you work and so for how long as you like but you still gain a paycheck weekly. —->>>LEARN A lot more About That here-> V15.UK/96i5Z

    dfdsfdsf

LEAVE A REPLY

Please enter your comment!
Please enter your name here