Monday, May 26, 2014

Porting an MVC4 App from VisualStudio to MonoDevelop

I recently created a demo shopping cart application using VisualStudio Express 2013 and MVC4. This meant spending some time in Windows.  But, I was quite impressed with MVC4. This is a vast improvement over the old viewstate based web apps. Plus, there is asset bundling support. This was worth the time spent using Windows.

When I was done, I wanted to log back into my Linux machine and port my project to Mono. The first thing I did was upgrade to Mono 3 and MonoDevelop 5. And then I set about porting my demo. MonoDevelop only has MVC3 templates, so first, I had to find an MVC4 template, Now I was ready to get started.

With most IDE's, you can just drop files into a folder and forge ahead. But MonoDevelop uses the VisualStudio project structure that mirrors the file system. So I  fired up MD, loaded my template, renamed it, and deleted all of the boilerplate. Then I visited each project folder, right clicked, selected Add Files from Folder, and dragged in all of the source from my original project.  This worked for everything except the Model.

Since Linux doesn't support MSSQL, I decided to use MySQL, with NHibernate for my ORM. I prefer a database first design process, so the first thing I did was update the sql script that creates my database and stored procs. Then I copied in the domain objects created by EntityFramework, changing the properties to virtual. The real work was creating the xml bindings -  but I actually prefer doing it manually, it is much easier to update than the tedious VisualStudio process of deleting and rerunning the wizard. Plus, you have much more control over the final product.

Thas is it. You can see the result at http://monomart.apphb.com. And compare the projects on github. The original VS project is at https://github.com/darkoverlordofdata/minimart, and the MonoDevelop project is at https://github.com/darkoverlordofdata/monomart.

8 comments:

  1. Excellent post!!! The future of .net application development is on positive note. It offers huge career prospects for talented professionals all over the world. Training on .net technology will ensure good salary package. Best DOT NET Training institute in Chennai | DOT NET Training

    ReplyDelete
  2. It was really a wonderful article and I was really impressed by reading this blog. Your technical information is very useful for me. Thanks for sharing your ideas.

    Regards...
    Hacking Course in Chennai

    ReplyDelete
  3. Hi Admin,
    Excellent blog and its totally loaded with valid posts on Java and .Net technology. Consider including RSS feed in your blog, so aspirants like me can follow your blog easily. Dot Net Training

    ReplyDelete
  4. Much thanks to you a cluster for offering this to every one of us you really acknowledge what you are discussing! Bookmarked. If you don't mind likewise look for guidance from my site =). We could have a hyperlink change contract between us! FtiOS Android

    ReplyDelete
  5. I truly welcome the sort of points you post here. A debt of gratitude is in order for sharing us an incredible data that is really useful. Great day! Tinyumbrella Mac

    ReplyDelete
  6. I was surfing net and luckily ran over this site and discovered extremely fascinating stuff here. Its truly amusing to peruse. I delighted in a ton. A debt of gratitude is in order for sharing this magnificent data. NessTool Download

    ReplyDelete
  7. Awesome information! I as of late ran over your online journal and have been perusing along. I thought I would leave my first remark. I don't recognize what to say with the exception of that I have. Mojo Installer

    ReplyDelete