Getting Started with .Net Core MVC in Ubuntu

Microsoft has been working hard to bring .Net (Core) to Linux so lets explore the fruits of their labor.


Personally I’ve grown fond of C# and  I love that the new Microsoft is embracing Linux and it doesn’t hurt that it’s starting to perform better than the competitors out there like Node.js. I also personally like that C# syntax is close to PHP, which made it easy for me to learn, and that Visual Studio Code/Community “Intellisense” (code autocomplete if you will) makes writing C# fun and relatively easy. Lastly I like the fact that C# is compiled code and not a scripting language and that it can be written into everything from a console application to a Web Application.

Need more reasons?


First lets go over some things you should have to start this:

  • Visual Studio Code (Download Link)
  • NPM (Terminal command)
sudo apt-get install npm
  • Update NPM version to latest (Terminal command)
sudo npm install -g npm
  • Install Node.js (Terminal command)
sudo apt-get install nodejs-legacy
  • Install Yeoman (Terminal command)
sudo npm install -g yo
  • Install ASP.Net Generator (Terminal command)
sudo npm install -g generator-aspnet
  • Install Bower
sudo npm install -g bower
  • Install .Net Core SDK
  • Some of the Microsoft Yeoman templates now use “old” .Net Core versions. This will fix those dependencies by installing all .Net Core Framework versions.
sudo apt-get install dotnet-dev*

Getting Started

That should cover the pre-requisites needed but if I missed anything please comment below. Now lets start our Web App.

mkdir mywebapp

cd mywebapp

yo aspnet

Note: If you get this error ” permission denied ‘/home/user/.config/configstore/insight-yo.yml’ You don’t have access to this file.

Then try this fix (I received this error on Ubuntu 17.04.):

sudo chmod -R 777 ~/.config/".

You should now have a screen like this one:

yo aspnet

Lets Choose “Web Application” (down arrow twice) and hit enter.

bootstrapNow lets choose Bootstrap for our UI framework


Type a name and hit enter (I choose mywebapp again).


At this point we can follow the instructions printed above in green and run our web app.


cd mywebapp

dotnet restore

dotnet run


At this point your new web application should be compiled and running locally on port 5000



Visual Studio Code

Now that you have an application framework downloaded and running it’s a great time to fire up Visual Studio Code and take a look at the source code.

So open Visual Studio and go to file -> Open Folder and choose mywebapp/mywebapp under your home folder or wherever you ran mkdir in your terminal earlier. It should look like this:


From here I’m not going to go over creating an MVC application because that has already been done very well in other places.

For the basics on ASP.Net MVC

I would start here:

The previously suggested videos above are from when I learned MVC on .Net before .Net Core but now that I’m learning more I’m finding that much has changed so I would recommend going here instead:

This post was based largely on this ASP.Net Core tutorial for OSX and modified for Ubuntu.

Thank You

Thanks for reading. If you found any of this useful please share this page and if there’s any questions or comments please add them below and I’ll be happy to respond when I can.

5 thoughts on “Getting Started with .Net Core MVC in Ubuntu

  1. Hi – following your tutorial (with prerequisites) … as I understand it currently (in limited fashion) … I think you need nodejs-legacy to precede Yoeman (Yoeman seems to look for ‘node’ and fails for me unless I first install nodejs-legacy). Ubuntu 16.04 Lts. I’ve already installed Visual Studio Code and .Net Core. Looking like a good tutorial, ta.

  2. I ran this tutorial again with a clean install of Ubuntu 17.04 and it’s not a dependency for what is covered here but certainly all of the front-end scripts in .Net core come from bower so it will be a requirement for further development.

  3. @Davros you are correct. Thank you! I was also able to fix that error by a permissions fix (sudo chmod -R 777 ~/.config/) but it is better just to fix the order.

Leave a Reply to Davros Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s