Over the last several months FubuMVC has gone through a lot of changes in preparation for 1.0. The good news is that all of the major reorganization and repository breakout is done. If you’ve been hesitant to work with FubuMVC due to the large amount of churn that should begin to settle down now and it might be a good time to start getting familiar with the latest changes. I’ll let Jeremy explain what’s been going on, but many of the changes could be categorized into the following reasons.

  1. Heavily leveraging bottles and breaking things out allowing many features to evolve on their own rather than all getting bundled into FubuMVC itself. The diagnostics is one example of this.
  2. Simplifying what it takes to get a FubuMVC application up and running and trying to remove ceremonial configuration of your conventions (yes you read that right).
  3. General improvements to stabilization and reducing the possibilities of bottles stepping on another bottles toes.
  4. Adding additional diagnostics information.

Okay already, on to the code!

As of today you’ll need to add a reference to FubuMVC’s private nuget feed in your Visual Studio settings because the code has not been published to the public nuget feed until we update some documentation to reflect the latest changes.

Feed Url: http://build.fubu-project.org/guestAuth/app/nuget/v1/FeedService.svc/

Start first by creating an ASP.NET Empty Web Application project. Assuming you’ve added the private feed mentioned above install the following nuget packages.

  1. FubuMVC.StructureMap
  2. FubuMVC.Diagnostics

Those two packages will bring in the remaining nuget packages we’ll need to get started.

Add a Global.asax and a FubuRegistry class like below. We’ll later do a little bit more with the registry but for now it’s empty.

Without doing anything else hit F5 and browse to http://localhost:{your port}/_fubu and look around and read what’s available. This is FubuMVC.Diagnostics and will be crucial for you as you begin to learn and use Fubu. Also notice that we didn’t have to setup any view engines? This is because of the recent work to extract out what we’ve been calling drop-in bottles. This removes some of the configuration that was necessary previously.

Update: Some may have issues with assets not loading in the diagnostics when running on IIS. If so, you can add this to your web.config.

Now let’s add our first route. Add a folder called Features at the root of your project. Add another folder inside Features called Home. In the Home folder Add 3 classes HomeInputModel.cs, HomeViewModel.cs, HomeEndpoint.cs and a Home.spark view template. The input model class will be empty. HomeViewModel.cs, HomeEndpoint.cs, and Home.spark should look like below (I know it’s not proper HTML). You can of course change this folder and code organization, but you’ll see that others find it quite useful.

Go back to the diagnostics page and see what has changed. You should see a new route (ugly as it may be). Browse to that url and you should see your page. The reason this works without doing anything in your FubuRegistry class is because there is a default convention for classes suffixed with Endpoint are actions. Now rename your HomeEndpoint class to HomeController. Go back to the diagnostic routes and you’ll see your route no longer exists.

Let’s customize things a bit. Go back to your FubuRegistry class and change it to the following.

Hit F5 again. Now you should see your route as the default route. Go back to diagnostics to see the new constraint as well.

This gives you a brief introduction into getting started with the latest FubuMVC changes. When you’re craving to find out more, the documentation is still a good place to start. Even though some pieces are still missing and some are a little out of date, many aren’t. If you find yourself still struggling with something, post a message to the FubuMVC discussion group. We’re usually pretty quick to help out.