Developing ASP.NET MVC Apps Using Mono

As some of you know may know, the Mono Project allows your .NET Framework applications to run cross platform. Mono’s .NET implementation is based on the ECMA standards for C# and the Common Language Infrastructure. It is really an amazing project. Check out the project  roadmap and compatibility matrix. I was pleasantly surprised to find the following:

imageI had not realized that ASP.NET MVC had been implemented by the Mono Project team. The Mono Project has implemented Visual Studio tools to allow you to develop for Linux without leaving Visual Studio. They also put together virtual machines that are loaded with Suse Linux, Mono and all the tools you need to get started. This post will provide you with the steps to begin developing with ASP.NET MVC in a Linux using one of the virtual machines.

Download The Files

You will need two downloads to get started. First go and download VMware Player. You will need to fill out the registration page to receive a link in an email for the download. Next, download the VMware image from the Mono Project page. Be aware that these links may break in the future as new version become available. In that case you may need a little help from Google.

Install VMware player on your machine. Unzip the VMware image. Right click on the ‘.vmx’ file and you should see something like the following:

image Select the ‘Open with VMware Player’ option. You can ignore the download VMware Player tools option. If everything goes well your distro of SUSE Linux should start and you will see the following desktop.

image The Mono Project Team has been kind enough to set this image up with everything you need to get started developing. On the desktop you can see the Mono Development Environment (the IDE that you will use in a bit).

A Quick Fix

If you double click the ‘Mono Web Applications’ folder you will be shown the following web sites:

image If you attempt launch any of the sites that require PostgreSQL you will be greeted with the following screen:

imageIf you do a Google search you will eventually find the following instructions:

  1. Click the ‘Computer’ button in the lower right hand corner.
  2. Click the ‘Gnome Terminal’ option.
  3. Type ‘su’ and ENTER.
  4. At the Password prompt, type ‘mono’ and ENTER.
  5. Type ‘vi /var/lib/pgsql/data/pg_hba.conf’ and ENTER.
  6. Scroll to the bottom of the editor screen.
  7. Type ‘i’ to enter insert mode. And change the top two ‘ident’ elements to ‘trust’ as shown below.
     image
  8. Press the ESC.
  9. Type ‘:wq’ and ENTER to save and quit.
  10. At the terminal window type ‘service postgresql restart’ ENTER.
  11. Close the terminal window.

Now if you refresh your page you should see the following:

image

Mono Development Environment

Start the Mono Development Environment by double clicking the icon on the desktop. It will look something like this:

image
Select the ‘Start a New Solution’ option on the Welcome page. Expand the C# options, select ASP.NET and then the ASP.NET MVC Project. Choose a ‘Name’ & ‘Location’. When your done you should have a dialog that looks like the following:

image Click the ‘F
orward’ button. The next dialog allows you to add project features. Don’t add any. Click the ‘OK’ button. Now your IDE should look like the following:

image Notice that a sample ‘Home’ controller and view have been added. Click the ‘Debug’ button (in the red square above) or press F5 to start the debugger and show the web page. Here is the result in FireFox:

image

Summary

Now you are ready to start your development. I found the Mono Development Environment to have most of the features that you are used to in Visual Studio. Features such as tooling to create controllers, views; intellisense; and debugging are available. Don’t forget to install your favorite FireFox add-ins.

Comments
  1. Heapxanax72xmd
  2. bet365
  3. Brittani Corker

Leave a Reply

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

*