Turn your Razor helpers into reusable libraries

Note: the generator has evolved since this post. Although the post is still worth reading, please go to http://razorgenerator.codeplex.com/ for the most up to date doc. The first blog post I ever wrote was titled “Turning an ascx user control into a redistributable custom control”.  It was almost exactly five years ago, and it still gets a…

41

Light up your NuGets with startup code and WebActivator

[Please see the WebActivator wiki for the latest docs] Wow, it’s hard to believe that it’s been less than a week since NuGet went public.  We were hoping to get noticed, but the attention we got was way beyond my wildest expectations!  The buzz on Twitter has just been phenomenal, and for the most part the feedback…

30

T4MVC 2.6.20, and upcoming T4MVC talk at MvcConf

I just pushed T4MVC out to the MvcContrib CodePlex site.  You can go to the T4MVC Home Page to get started with it. Last time I blogged about a T4MVC release was for 2.6.13.  In the mean time, I released 2.6.14 and 2.6.15, but they were minor updates so I just tweeted them.  You can…

12

Check out Chirpy, a very cool Add-In to run T4MVC and do many other cool things

Just a quick post to point folks to a very cool CodePlex Add-In that you may not know about.  It’s called Chirpy and can be downloaded from http://chirpy.codeplex.com/.  The reason I discovered it is that it includes functionality to automatically run T4MVC.  In fact, it is basically the new version of the Add-In by Wayne…

2

An even better way to run T4MVC: a VS AddIn

Last week, I blogged about a nice way of auto-running T4MVC by using the Macro IDE to write an OnBuildBegin event handler.  This was a big improvement over the hacky ‘AlwaysKeepTemplateDirty’ flag that we’ve been using since T4MVC’s early days. Since then, Wayne Brantley has taken this idea to the next level by turning it…

8

A better way to auto-run T4MVC when you build

Update: also see the newer post on this topic   T4MVC has always struggled with finding the right way of running automatically when you build.  Being a T4 template in your project, by default it just runs when you save it.  This is not great, because you really want it to rerun whenever you make…

16

T4MVC 2.6.13: now officially in MvcContrib, with a few new features

To get the latest build of T4MVC: Go to MvcContrib T4MVC page on CodePlex   A few weeks back, we announced (mostly on Twitter) that T4MVC was moving into the MvcContrib Codeplex project.  I didn’t say much about it at the time because there wasn’t a whole lot to say yet, in the sense that…

1

Debugging ASP.NET generated code

Update 2/4/2010: changed Technique #2 to use Debugger.Break()   This post applies to any ASP.NET app that uses .aspx files, whether WebForms or MVC. When you write an aspx/ascx/master file (I’ll just say aspx for here on, but it applies to all), it gets compiled dynamically by the ASP.NET runtime.  Note that this is true…

12

Take your MVC User Controls to the next level

Note: this is based on ASP.NET MVC 2 RC, and will not work on earlier builds.   The quick pitch: make your User Controls as cool as built-in render helpers! The goal of this post is to show you how to change the way MVC user controls are called from something like this: <%= Html.Partial("~/Views/Shared/gravatar.ascx",…

31

T4MVC 2.6.10: fluent route value API, shorter way to refer to action, and more

To get the latest build of T4MVC: Go to T4MVC page on CodePlex I just posted build 2.6.10.  There were also a few builds in between since I last blogged about 2.6, so this post describes some of those changes (full history here). Fluent route value API As you probably know, T4MVC uses a pattern…

7