A bit premature on this post due to a little bit of rework I’m doing to FubuMVC.Razor. However, this past week I’ve heard a bit of gripes with how much the Razor implementation sucks and that it should just be dropped all together. Therefore, this post is really just to address how to get intellisense up and working for VS 2012.


This is still running System.Web.Razor 1.0. Don’t try to update, if you do and feel pain I told you so. Currently the implementation is leveraging RazorEngine to handle the rendering of templates and it hasn’t been updated for 2.0 yet. More on this a little bit later.

Step 1 – Initial Project Setup

Follow the instructions similar to the getting started guide here. Stop before adding any views and we’ll continue here with Razor specific instructions. In my sample I chose to use .NET 4.5.

Step 2 – Add Nuget References

Again, using the Fubu private nuget feed add a reference to FubuMVC.Razor.

Step 3 – Add Razor Views

Now add the following views assuming you followed the steps from earlier and already added everything else like HomeEndpoint etc. To simplify things modify you FubuRegistry to change the default route like below.

Make sure to place mypartial.cshtml, and Application.cshtml in a Shared folder at the root of the project. Also note, that adding in your template Layout = “Application” is optional as it defaults to Application if it isn’t specified. This is different than the ASP.NET MVC behavior.

Now if you run your application you should see a working page that renders markup from the page, layout, and partial. Also note, don’t use Include(“name”, model) overload it currently isn’t supported. More on that later.


Oddly enough there’s a few hoops to jump through to get the Visual Studio intellisense. None of this is required to actually render the views.

  • Add a reference to System.Web.Mvc, yes folks “@model TypeName” doesn’t work without it. Because this is only useful in MVC projects?
  • Make sure any references you bring in don’t require System.Web.Razor 2.0 for instance MVC 4
  • Modify your web.config to include what’s below. This information will inform the tooling which template base class to use, and which namespaces to import so you can get the proper intellisense.
  • At this point your tooling should begin to work, if not restart Visual Studio for safe measure.

The Proof

The proof

In Closing

Hopefully this will help some get started using Razor with FubuMVC. I am currently working on updating to Razor 2.0 and should be done in the next week. In doing so I have decided to remove the dependency on RazorEngine. This should clean up some of the template API and make things more discoverable going forward. I plan to also change Include to be RenderPartial to be more consistent with ASP.NET MVC and I may begin to support the overload I mentioned earlier.