Mono doesn’t support ASP.NET Web Site Projects

When I first heard about Mono and it’s wonderful features that allows to host ASP.NET web sites in Linux environment, I have to admit… I jizzed a little in my pants… :B

Imagine hosting ASP.NET code without the need of Microsoft Licence, makes me love Open Source more. Man… I was excited… until today…

The adventures begins when I start setting up MonoDevelop and source control with Git on my Mac, cloned the repository of code (which was previously written with Visual Studio and running nicely in the production server).

Visual Studio's "Open Web Site"

Couldn’t find “Open Web Site” options that I use to open my ASP.NET Web Site in Visual Studio (refer to image1). Tried opening and created few new projects to run my existing codes, in the process, I have to manually add reference to some of the .NET Framework’s DLL (Example: System.Data.SqlClient).

 

 

After few try and failure, I seek answers from the wise “Google”. After that I was screaming OMFG (in my mind) when i saw the few discussions (the discussion that made me drop down from cloud 9 is listed at the bottom of this post).

It turns out that Mono only supports ASP.NET Web Application Project, and not Web Sites Project.

Is a disappointment at the moment, but I strongly believe that the best of Mono will continue to grow and become awesome one day. Until then, We’ll will have to wait patiently.

I’ll write another post to explain why ASP.NET Web Application Project doesn’t fit in a consumer based web site. Stay tuned. :B

Updates on 29 April 2012:
It seems that I’ve made a mistake on Mono, Mono do support ASP.NET Web Site Projects.
Is MonoDevelop that doesn’t support it, a Mono rookie mistake i made like others.
Tested and verified!!
Found out the answer by a link sent by “The General”, click here to find out more.

Reference:

Generate Nested object with Json.NET’s JsonWriter

Been using Json.NET for the pass few months for projects that is related to JSON, a wonderful features provided is to allow you to Serialize your .Net objects to JSON format automatically.

string json = JsonConvert.SerializeObject(myObject);

For my case, my objects is shared between search results and detail page, search result required around 15 values where as the detail page have 50 values.

Using the JsonConvert.SerializeObject() method will make my search result’s JSON large in size, so i decided to use the manual way of generating the JSON via JsonWriter.

However, took me some time to generate a nested object JSON string.

Code   
  1. using (JsonWriter jsonWriter = new JsonTextWriter(sw))
  2. {
  3.     jsonWriter.WriteStartObject();
  4.     jsonWriter.WritePropertyName("model");
  5.     jsonWriter.WriteValue("Impreza");
  6.  
  7.     jsonWriter.WritePropertyName("brand");
  8.     jsonWriter.WriteValue("Subaru");
  9.  
  10.     jsonWriter.WritePropertyName("Engine");
  11.     jsonWriter.WriteStartObject();
  12.     jsonWriter.WritePropertyName("cc");
  13.     jsonWriter.WriteValue("2500");
  14.     jsonWriter.WritePropertyName("type");
  15.     jsonWriter.WriteValue("boxer");
  16.     jsonWriter.WriteEndObject();
  17.  
  18.     jsonWriter.WriteEndObject();
  19. }
Results   
{
    "model": "Impreza",
    "brand": "Subaru",
    "Engine": {
        "cc": "2500",
        "type": "boxer"
    }
}

Reference:
Serializing/Deserializing Dictionary of objects with JSON.NET

Android Project “NoClassDefFoundError” after ADT 17 upgrade

Was in the middle of bug fixing and enhancing 3 Android Projects of mine today, noticed that ADT 17 is out, so decided to upgrade it.

Before the upgrade, my projects seems to be running and working fine.
After the upgrade,  everything seems to crash and the following error is shown at LogCat

04-04 05:10:31.249: E/dalvikvm(230): Could not find method com.google.android.apps.analytics.GoogleAnalyticsTracker.getInstance, referenced from method my.com.website.Menu.onCreate

After google around, found that someone found the solutions, here are the steps I’ve done:

  1. Remove the libraries from the standard Java build path:
    Right click on the project name > Properties > Java Build Path > tab libraries > remove everything except the “Android x.x” (1.6 in my case) and the “Android Dependencies”
  2. Create a folder named “libs” in the project
  3. copy and paste all the external .jar that is required in your project folders via Window Explorer.
  4. Go back to Eclipse and refresh the project and build your project. (I’m developing in Window Environment)
  5. If successful, you’ll be able to see “Android Dependencies” have the list of external .jar files that your project is referencing.
Here are the screen shots of before and after the changes:
Before upgrade to ADT 17
Before upgrade to ADT 17
After upgrade to ADT 17
After upgrade to ADT 17
The original link to the post that help me solve this issue. Link