Tuesday, 19 June 2012

Asp.net MVC 4 WebAPI RC - What on earth is “Antlr3.Runtime”?!

I upgraded to the latest version of Asp.net MVC 4 at the weekend which is the newly released “RC” so thought I’d have a play and see what’s changed.

On doing File > New on a new MVC 4 / Web API project a newly clean crisp solution loads up in Visual Studio. Just out of interest I make sure it builds – can’t be too careful with these “pre-release” builds. The solution builds fine so it’s time to explorer …

I expand the project references to see what dependencies the project now has and the list is quite large. The usual suspects are there; EntityFramework, System.Web.Mvc, System.Web.Razor etc. but I’m greeted by some un-usuals.

Disclaimer: I’ll point out now I didn’t do this check on the Beta so I’m not sure if some of the following where there before.

The first one is new and expected; Newtonsoft.Json. We’ve been hearing for a while that json.net will be rolled into the final release and here it is. Nice! I’ve been using json.net for other projects for a while and it’s good.

The second two which seem out of place are “Antlr3.Runtime” and “WebGrease”. What on earth are these?

Lets look at WebGrease first …

  • It has an entry in the nuget package file with a version number etc.
  • In object browser it has some of the “Microsoft.Ajax.Utilities” namespace in.
  • The rest seems to do with css, ui etc.
  • Delete it and the app still builds and runs.

Guessing can live with that, but could remove it. What does it do?!

The other remains a mystery; “Antlr3.Runtime”.

  • No entry in the nuget packages
  • Remove it and the default app still builds
  • In object browser from the class names it looks like it does something with Tree structures?!

From doing some searching it relates to parsing grammers etc. to interpret them in your application. Why would that be shipped with asp.net mvc 4? Couldn’t find any documentation to support this so maybe it was an oversight and will be removed from the final RTM version. Will have to wait and see …

3 comments:

@J0eSmith said...

WebGrease contains the Bundling/Minification framework. Antlr3 supports the B/M framework. See my tutorial http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification

Once you delete these, do a clean, build, run and you'll get the following error: Could not load file or assembly 'WebGrease

Adam Storr said...

@Obomba - Thanks for your comment and link. Interesting reading.

@J0eSmith said...

Thanks for pointing this out, I've updated my tutorial.