ASP.NET MVC Source Code Now Available – ScottGu’s Blog

As an fan of all things MVC, today’s news of the release of the ASP.NET MVC Source Code was really good news.  I think it shows Microsoft’s continued steps toward being open source. 

Scott Guthrie was the one breaking the news and he has some details on his blog to check out.  The source was released as part of a CodePlex project and can be found as part of the ASP.NET CodePlex project, where the source can be found and downloaded.

Scott Hanselman also has a great post about his thoughts on the ASP.NET MVC source code and goes into some detail in The Weekly Source Code.  It’s really nice to see Scott spend the time pointing us to various areas of the source code.  It’s good stuff and worth the read.

In case you missed one of Scott’s earlier examination of the ASP.NET MVC Source you should also check it out.


Fixing the Toolbox in Visual Studio 2005

I have had the extreme pleasure of working with Microsoft SQL Server 2005 Reporting Services lately (notice the extreme sarcasm in my tone).  I am working on a project for a large client and one part of the project requires I enhance a report to support multiple languages.   This post is not about localization but a rather strange issue I faced today.

I opened up my project in Visual Studio and proceed to open the report I needed to analyze for changes and decided to look at the controls at my disposal to help enhance the report and was greeted by this set of controls:


Interesting, all the controls are just Textbox.  Obviously this isn’t right and I had to do a bit of searching around the net for a few things to try.  The first suggestion I found was to right click the Toolbox and select Reset ToolBox….this had no effect.  Several suggestions didn’t seem right but I finally tried one which worked.  It involved a few steps:

  1. Shutdown Visual Studio
  2. Locate the directory – C:\Documents and Settings\<user name>\Local Settings\Application Data\Microsoft\VisualStudio\8.0
  3. Delete all files named Toolbox.* (there were 4 of them)
  4. Restart Visual Studio

The directory listing where the Toolbox files live looked like this:


When Visual Studio restarts it will recreate the Toolbox files based on what is installed on the system.  After restarting Visual Studio my Toolbox looked like this when editing a report:


The steps are pretty trivial when you know what they are but finding the solution took a bit of spelunking but it worked like a charm.  I don’t know what actually caused this to happen but I don’t have the time to find out why.  If someone has the reason I would love to know why.

ASP.NET MVC Framework Preview 2 – Changes for the Better

The team providing us with the ASP.NET MVC Framework made available the 2nd preview release during the MIX08 Conference March 5-7, 2008 in Las Vegas, NV.  This release has many great changes as they team works toward an RTM maybe later in the year, but no promises were made.

I just wanted to point out some of the bigger changes in the Preview 2 release.

The ASP.NET MVC Framework can be deployed in the \bin directory of an app and work in partial trust

One of the pain-points in the current CTP of the ASP.NET MVC Framework is the framework is installed with a setup program to register it in the Global Assembly Cache (GAC), this is fine for local installations on development machines but not good when need to deploy to other systems.  Microsoft is fixing this:

Starting with this upcoming preview release we will enable applications to instead directly reference the System.Web.Mvc.dll assembly from the application’s \bin directory.  This means that no setup programs need to be run on a sever to use the ASP.NET MVC Framework – you can instead just copy your application onto a remote ASP.NET server and have it run (no registration or extra configuration steps required).

Requiring  System.Web.Mvc.dll to be in the GAC also made it unlikely to be able to use the MVC framework with shared hosting providers, the new CTP will also fix this potential problem as well:

We are also doing work to enable the ASP.NET MVC framework to run in “partial/medium trust” hosting scenarios.  This will enable you to use it with low-cost shared hosting accounts – without requiring the hosting provider to-do anything to enable it (just FTP your application up and and it will be good to run – they don’t need to install anything).

It’s unlikely anyone would have faced these issues yet, since the MVC is so new, but good to know it was thought out in advance.

Significantly enhanced routing features and infrastructure

URL routing is one of the most powerful features of the MVC framework, letting developers have infinite control over the structure of the URL’s in their applications. 

This upcoming ASP.NET MVC preview release contains even more URL routing features and enhancements.  You can now use named routes (enabling explicit referencing of route rules), use flexible routing wildcard rules (enabling custom CMS based urls), and derive and declare custom route rules (enabling scenarios like REST resources mappings, etc).

We have also factored out the URL routing infrastructure from the rest of the MVC framework with this preview, which enables us to use it for other non-MVC features in ASP.NET (including ASP.NET Dynamic Data and ASP.NET Web Forms).

Improved VS 2008 Tool Support

The initial release of the MVC framework shipped with some useful but simple templates for web projects but improvements are coming:

This upcoming ASP.NET MVC preview release will ship with improved VS 2008 integration.  This includes better project item templates, automatic project default settings, etc.  We are also adding a built-in “Test Framework” wizard that will automatically run when you create a new ASP.NET MVC Project via the File->New Project dialog.  This will enable you to easily name and wire-up a unit test project for your ASP.NET MVC application.

The Test Framework wizard will allow the developer to choose from a list of available unit testing frameworks but is pluggable to allow for additional testing frameworks to be added.

[ControllerAction] Attribute No Longer Required on Controller Action Methods

The first MVC framework required developers to use the [ControllerAction] attribute to distinguish action methods on a controller in order for it to be callable from an application.  Due to developer feedback the new release will do away with this requirement and make all public methods defined on a controller to be action methods and therefore callable.

There will be attributes available to use to make a public method a non-action method.

New Filter Attribute Support for Controllers and Action Methods

A new feature being added to the release are Filter Attributes.  Basically, these attributes are actions a developer may want to execute either before or after a controller or its action executes.

These enable you to inject code interceptors into the request of a MVC controller that can execute before and after a Controller or its Action methods execute.  This capability enables some nice encapsulation scenarios where you can package-up and re-use functionality in a clean declarative way.

HTML Helpers Built-in

Helper methods were limited in the first release of the framework, where a separate download was made available which included a bunch of HTML helper methods.  The new release will have all of the optional helper methods built-in.  Future framework updates will include ASP.NET AJAX support:

Next month we are also going to start to talk about some of the new enhancements to the client-side ASP.NET AJAX libraries we are making, as well as some of the AJAX helper methods we will build to enable it to easily integrate with ASP.NET MVC.

These were the HTML helper methods developed by Rob Conery.

Lots of Refactoring and Design Improvements

As with any public CTP of a product, the idea is to iterate and evolve the product into something people will use.  The team is making design improvements to the existing code base to allow for better extensibility.

In general the team has followed a philosophy where for all features you have three options:

  1. Use the built-in features/implementations “as-is” out of the box
  2. Slightly customize the built-in features/implementations without having to write much code
  3. Completely swap out the built-in features/implementations for custom ones

For example: you can now override the ViewEngine locator logic without having to override the ViewEngine execution logic (and vice-versa) – or alternatively swap out ViewEngines entirely.  The Controller Factory support has been extended to make it even easier to integrated with dependency injection frameworks.  Route rules are now fully extensible.  Controllers are more easily testable, etc.

This type of flexibility gives developers choices, not forcing them into doing things a certain way which can help improve the ability for developers to more quickly adopt the framework.

Downloadable ASP.NET MVC Framework Source that can be Built and Patched

Following the lead of downloadable .NET Framework source code, the team will be making the source code for the MVC framework available with the same methods.

Starting with this next preview, we are also going to make the ASP.NET MVC Framework source code downloadable as a buildable VS project solution.  This will enable you to easily view and debug the ASP.NET MVC Framework source code.  We are also going to include a license that permits you to optionally make patches to the ASP.NET MVC Framework source code in the event that you run into a bug in an application you are developing with it.

The license won’t enable you to redistribute your patched version of ASP.NET MVC (we want to avoid having multiple incompatible ASP.NET MVC versions floating around and colliding with each other).  But it will enable developers who want to get started building ASP.NET MVC applications immediately to make progress – and not have to worry about getting blocked by an interim bug that they can’t work around.

Screencasts Showing-off Features

Scott Hanselman has put out some great screencasts to show off how the ASP.NET MVC works in its current iteration.  At the time I write this there are 4 screencasts available showing increased complexity while working on the same sample code base.

Also available is Scott’s session at MIX08

Developing ASP.NET Applications Using the Model View Controller Pattern

I have taken the time to work with this Preview 2 of the ASP.NET MVC Framework and developed some simple applications, which worked wonderful.  My experience with Ruby on Rails really helps in understanding this framework.  Comparing the first CTP to this one is really a night and day difference, in my opinion.  I am looking forward to future releases and building real applications this way on .NET.

First Meeting of the Hartford Ruby Brigade

The inaugural meeting of the Hartford Ruby Brigade is coming March 24, 2008 at the East Hartford Library.


Dan Bernier ( talking about the Ruby Facets gem.


We will be holding a raffle for a book from our generous sponsor Addison-Wesley.  This will be a regular occurrence at our meetings.


East Hartford Library
840 Main St
East Hartford, CT 06108

Date & Time

March 24th 2008

Great Interview at MIX08 with John Lam

Aaron Junod, my co-author of Professional IronRuby I talked about already, did a great interview with John Lam at the recent MIX conference in Las Vegas.  Aaron asked some great questions and as always John answered them very openly giving all those IronRuby enthusiasts something to look forward to.

The interview covers a lot, including:

  • IronRuby
  • Microsoft and Open Source
  • Microsoft working with Open Source developer community
  • Future of IronRuby and the Microsoft dynamic languages

Please check out the interview with John Lam at the RubyDoes.NET web site.

Professional IronRuby – Coming to a bookstore near you

I finally found a bit of time to blog about a book I am writing with a friend of mine, Aaron Junod.  You may be familiar with Aaron from the RubyDoes.NET web site.  The title of the book is, you guessed it, Professional IronRuby and is being published by Wrox/Wiley Press.  The topic is of course, IronRuby.  Since the RTM of IronRuby will likely be the end of the year you should see the book in stores in the November time frame.

I don’t really know what made me take the plunge to write a book let along strive for a good.  I have enjoyed writing on the blog here and also for InfoQ which I am both a .NET and Ruby editor, so I guess the topic of Ruby on .NET really made sense to me.  I will post an image of the book cover once we have it, which will contain the usual author photos.  Yes, you get to see my ugly mug.

The goal of the book will be to discuss Ruby on .NET, not be an introduction to Ruby.  We will take the time to give a short overview of Ruby, an overview which will be enough for experienced .NET developers to know how to create the same constructs in IronRuby as they do in their native .NET language of choice.  We will discuss all of those things important to developers interested in exploring and creating great applications using dynamic language.

Draft Table of Contents

We are fortunate enough to have our Forward written by John Lam, I can’t think of a better person.  The Table of Contents below is just a draft and may change based on additional items added to IronRuby later in the year.

  • Chapter 1 – Introduction to IronRuby?
  • Chapter 2 – Getting Started with IronRuby
  • Chapter 3 – Introduction to Ruby 
  • Chapter 4 – Objects
  • Chapter 5 – Conditional statements and flow control
  • Chapter 6 – Working with Files and Databases
  • Chapter 7 – Reflection and meta programming
  • Chapter 8 – Testing in Ruby
  • Chapter 9 – The Ruby Universe
  • Chapter 10 – Running Ruby on Rails
  • Chapter 11 – Creating Ruby on Rails Applications
  • Chapter 12 – Working with .NET classes/libraries from IronRuby
  • Chapter 13 – Working with WPF from IronRuby
  • Chapter 14 – Ruby and ASP.NET
  • Chapter 15 – Ruby and Silverlight
  • Chapter 16 – Calling IronRuby Code from .NET
  • Chapter 17 – Hosting IronRuby and the DLR in your application
  • Chapter 18 – A tour of the IronRuby source code, how the magic happens
  • Chapter 19 – Porting Ruby libraries to IronRuby
  • Chapter 20 – IronRuby and Mono

I would be interested to hear some feedback on what topic details readers might want to see in the book that either I have not mentioned or as a suggestion to include in the chapter topics I listed.

I am really looking forward to the whole experience.  So many people write books and say they will never do it again.  I am certainly not doing for the money but instead, the experience.  Writing this book so far has been eye-opening to the publishing process as well as gotten us closer to the Dynamic Language team and seeing the development of this important technology a bit closer than we normally would have.

Time Capsule Up and Running

I found some time this weekend to unpack the Time Capsule, set it up and perform my first back up.  I was going to provide the “unboxing” post I mentioned in a previous post but lost interest.  I am sure there are a ton of those types of posts out there if someone wants to search for them.  One thing I was surprised by was the size of the device.  It is a lot smaller than I expected and almost completely silent.



Setting up the Time Capsule

The first thing I needed to do to install and configure the Time Capsule was to install the Airport utility off of the included Time Capsule CD.  Once installed I ran the Airport Utility from the Applications->Utilities folder. 

I chose to setup Time Capsule wirelessly since it is the easiest, if it works.  It is pretty interesting that my MacBook Pro disconnected from my local wireless network and connected to the Time Capsule.  I probably shouldn’t be surprised, but I was.

The overall configuration was very easy, just stepping me through the configuration using a wizard.  I have an existing wireless network so I just added the Time Capsule to use that network.  I could have just as easily replaced the current network with the Time Capsule since it is a full Airport base station.  I may end up doing that at some point to take advantage of the 802.11n capabilities, but for now I just wanted to keep it simple.

Once I stepped through using the wizard the Time Capsule rebooted and my MacBook Pro was back on my original wireless network.   The amber light experienced on the Time Capsule during setup was now a nice green color, indicating all was well.

The First Time Machine Backup

I took my MacBook Pro and ran Time Machine for the first time and was delighted to see it find my Time Capsule right away and told me it would be starting a backup in 2 minutes.   I told Time Machine to skip my VMware Fusion virtual machines so it wouldn’t be backing those up all the time.

The backup started right on time and found 45g to backup.  The backup seemed to run very slow, taking about 16 hours to complete.  I am on a 802.11g network but I just figured it would take a lot less.  I didn’t try to figure out how long it should take but it was a lot longer for this initial setup.  I will be monitoring this in the future so I can determine if I need to change some things to get better performance.

Connecting with Windows Clients

I bought a Time Capsule so I would have Time Machine natively recognize it but also to backup my Windows clients too.  I was a little concerned with Apple’s support for Windows clients but was pleasantly surprised by the experience.  The key is to make sure File Sharing is turned on as seen in this screen shot.


Notice also the Workgroup is the Windows Workgroup on your network.  Once I set this and performed an Update the Time Capsule appeared in the list of my network devices in my workgroup.  Bringing up Windows Explorer shows the Time Capsule named Backup in the list:


When selecting Backup in the tree the user is prompted for credentials.  I was not sure of the user name so I chose the name of the device, Backup, and the password is the one chosen during the initial setup.   I was able to connect right away and create a new folder for my Windows files.


You can see the folder Time Machine created for my MacBook Pro backup.


I am really happy with the experience of setting this device up, it was easy and just worked.  I will follow-up later once I use it for a while both from my MacBook Pro and from Windows.   The only downside to the experience was how long it took to perform the initial 45g backup, which was a long time.  I may not have had my expectations set correctly.

The status back in Time Machine only tells the user how many files it is backing up, how much data needs to be backed up in total and a running status of the amount of data backed up.  I would like to see an estimated time to completion and more importantly, my current data transfer rate.