ASP.NET 5 on Linux

As mentioned in my last post, ASP.NET 5 is only supported on version 14.04 of Ubuntu. I know this because I originally installed it on version 15.10 only to have dnu and dnx silently fail. After much time spent troubleshooting, I found out 15.10 is not supported and started over with 14.04. Here are my notes for anyone else wanting to set up ASP.NET 5 on Ubuntu.

Versions

These are the versions of software used:

  • VirtualBox 5.0.12 r104815
  • Ubuntu 14.04.3 LTS
  • ASP.NET 5 RC1 Update 1
  • Visual Studio Code version 0.10.6

A note on VirtualBox:  I started with version 5.0.10, but launching VS Code would throw several OpenGL warnings and errors, and UI was flaky.  I updated VirtualBox to 5.0.12, reinstalled the Guest Additions, and the OpenGL errors went away, as did the UI problems.

Create an Ubuntu VM

Using Virtual Box 5.0.10, I created a new virtual machine and installed Ubuntu 14.04.  I allocated 2 CPUs, 2 GB of memory, 64 MB of video memory and enabled 3D acceleration.  Performance was acceptable on a Windows 10 host machine with an Intel Core i5 processor, integrated graphics, and 8 GB of RAM.  As noted above, I later updated VirtualBox to 5.0.12 and updated the Guest Additions on the Ubuntu VM.

Install ASP.NET 5

I ran through the installation instructions given in the ASP.NET 5 documentation without a hitch:

At this point I was able to run dnx and see the expected help text:

dnx-on-linux

I did not install Mono or DNX for Mono as I plan to work only with core clr to see what that experience is like.

Continuing on with the installation instructions, I installed libuv:

And that was it!

Install Visual Studio Code

I have used SublimeText 3 and like it, but I prefer VS Code because it lets me open multiple views, so I can edit a file in one pane and preview it in another, or edit multiple files at once.

I downloaded VS Code and unzipped the folder to /opt, which is the preferred location for user installed packages:

and created a symlink for it:

At this point I could run VS Code and have it display the contents of the current directory using code ., but I would see the following messages, and VS Code would not release the terminal:

Another person asked about this situation and adding this to .bashrc, as recommended by the accepted answer, took care of it:

See this post for help with finding .bashrc.

Test ASP.NET 5

To test things out, I created the following simple application, consisting of just a project.json file and Startup.cs file:

I used dnu to restore packages, and dnx to run the application:

Success!

aspnet-5-on-linux

Leave a Reply