In my last post, I showed an example of an ASP.NET MVC 4 application built in MonoDevelop. Since that time, an ASP.NET MVC 4 project template has been created for MonoDevelop that makes it very easy to create a similar app.
Here are the steps for using this template:
1. To get started, install version 3.0.2+ of Mono, the latest version of MonoDevelop, and the F# Language Binding (through the MonoDevelop Add-in Manager). If you've already installed each of these, make sure that the F# Language Binding version is 3.2.8+.
2. Create a new solution (File | New | Solution) and select F# | ASP.NET | F# ASP.NET MVC 4 (Razor) as shown here:
3. Add the desired solution name, click OK, and your done.
Well that was easy, but where do you go from here? Let's walk through a simple example of creating an app for keeping track of contacts. The end result will be similar to the screenshot shown in my post entitled A Single Page App with Backbone.js, ASP.NET Web API, and F#.
1. I've already followed the previous steps to create an ASP.NET MVC 4 application in MonoDevelop called MyContacts. To quickly add a decent look to the app, I'll use the responsive front-end framework from ZURB called Foundation. All that I really need is the CSS, so I add the foundation.min.css file to the Content folder in the project. I also add an app.css file for any custom styles that are needed. The content of the app.css file is shown below:
2. I can now reference these CSS files in _Layout.cshtml. The modified file looks like this:
3. Now I modify the Index.cshtml file in the Home folder so that it will display the list of contacts. The result is shown below:
4. Lastly we make a few modifications to the HomeController. Here's the code:
5. That's it. We can now launch the site and see the following:
Showing posts with label MonoDevelop. Show all posts
Showing posts with label MonoDevelop. Show all posts
Saturday, December 8, 2012
Monday, November 19, 2012
F#, ASP.NET MVC, and MonoDevelop
I often talk about creating web solutions with F# in Visual Studio. Today I'm going to switch things up a little and provide an example of an ASP.NET MVC solution built with MonoDevelop.
MonoDevelop:
For those that aren't familiar with MonoDevelop, it's an open source IDE that runs on a variety of operating systems including Windows, Mac OSX, and Linux. MonoDevelop works hand-in-hand with Mono, which is "an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET". This means that you can write the same .NET code that you would in Visual Studio and run it on any of the most popular operating systems.
Getting Setup for F# Development:
There are a number of resources out there that talk about how to get your environment setup with MonoDevelop and F#. Here's a quick set of steps:
1. Install MonoDevelop, .NET or Mono, and GTK# from http://monodevelop.com/Download.
2. Launch MonoDevelop and open the Add-in Manager (MonoDevelop | Add-in Manager... on Mac OSX and Tools | Add-in Manager on Windows).
3. Switch to the Gallery tab and install "F# Language Binding".
That's it. You're now ready to start building F# applications with MonoDevelop.
An ASP.NET MVC Project with F# and MonoDevelop:
MonoDevelop also supports ASP.NET MVC. To see an example, clone https://github.com/dmohl/FsMvc4MonoSample and open the solution.
The solution includes 2 projects:
1. A web project that includes Views and Controllers.
2. A unit testing project.
A screenshot of the Solution window is shown below:
MonoDevelop:
For those that aren't familiar with MonoDevelop, it's an open source IDE that runs on a variety of operating systems including Windows, Mac OSX, and Linux. MonoDevelop works hand-in-hand with Mono, which is "an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET". This means that you can write the same .NET code that you would in Visual Studio and run it on any of the most popular operating systems.
Getting Setup for F# Development:
There are a number of resources out there that talk about how to get your environment setup with MonoDevelop and F#. Here's a quick set of steps:
1. Install MonoDevelop, .NET or Mono, and GTK# from http://monodevelop.com/Download.
2. Launch MonoDevelop and open the Add-in Manager (MonoDevelop | Add-in Manager... on Mac OSX and Tools | Add-in Manager on Windows).
3. Switch to the Gallery tab and install "F# Language Binding".
That's it. You're now ready to start building F# applications with MonoDevelop.
An ASP.NET MVC Project with F# and MonoDevelop:
MonoDevelop also supports ASP.NET MVC. To see an example, clone https://github.com/dmohl/FsMvc4MonoSample and open the solution.
The solution includes 2 projects:
1. A web project that includes Views and Controllers.
2. A unit testing project.
A screenshot of the Solution window is shown below:
Subscribe to:
Posts (Atom)