.NET Tips and Tricks

Blog archive

Free Tools: ASP to Razor Converter

Somehow, in the course of our June Toolapalooza feature (17 Free Tools for Visual Studio), I missed a bunch of freebies from Telerik. Telerik has made well over a dozen free tools available -- I lost count -- and they all look pretty cool. It's worth noting, these are not limited-period trials or significantly crippled software. If you're willing to forego support, for instance, you can apparently get Telerik's ASP.NET MVC extensions for free.

I must have been in an ASP.NET MVC frame of mind when I was looking at the page because the tool that caught my eye is the Razor Convertor. This is a command line tool that, when passed a file spec (e.g. *.aspx) and (optionally) a path to a folder to hold the converted cshtml files, rewrites your Views to the new Razor syntax.

This is a big deal. Whenever you move to a new technology (like the Razor engine for creating Views in ASP.NET MVC) there's always the problem of what do you do with the old $#*! (sorry: "legacy code"). You could upgrade that old code, but it would take time away from other projects that will deliver new functionality and benefits. Besides, while the "legacy" code is in an old technology, it does have that whole "working" thing going for it.

But if you hang onto that old technology, you're effectively making your toolkit larger. Ideally, you want a toolkit that's as small (and as homogenous) as is compatible with meeting the demands of your organization. So it would be nice to clear out any old technology that you don't to use any more.

Razor Convertor lets you do that when you upgrade to ASP.NET MVC 3 and switch over to Razor (and you will want to switch over). Razor makes it reasonable for you to convert all the Views in an application that you're going to be working on for some other reason than bringing it up to date. Use the tool to convert the application's Views over to Razor, add any new pages using the Razor engine, make the rest of your modifications and you've got a site upgraded to the latest and greatest!

Telerik doesn't claim that the tool can convert all of your MVC Views with 100 percent reliability (it doesn't deal with Master Page Views, for instance). But, based on what I've seen so far, it will get you very, very close. My biggest issue, for instance, was going back in and converting any expressions in my code.

Now: After you bring a whole application up to date, do you tell your boss that you used a tool to do the conversion? Or just take the credit?

Posted by Peter Vogel on 07/26/2011 at 1:16 PM


comments powered by Disqus

Reader Comments:

Sat, Oct 29, 2011 Tom tyler Event planning jobs

Yes Pete, I've checked on Amazon.com as you said "There are actually proxies for this information: for books you can look at the books' rankings on Amazon.com and for courses you can look at how many training events are scheduled for the topic at a training organization". There is so many books that inform to me how many training events at a training organization.

Sun, Jul 31, 2011 Peter Vogel Canada

If you're saying that developers aren't using ASP.NET MVC, I'm not sure that's true. It's hard to get a handle on these things but I look at two things: how books and courses on the topic sell. There are actually proxies for this information: for books you can look at the books' rankings on Amazon.com and for courses you can look at how many training events are scheduled for the topic at a training organization. Right now, both measures tend to show a level of interest in ASP.NET MVC that, while lower than ASP.NET, is in the same ballpark.

Fri, Jul 29, 2011

Telerik's MVC extensions may be gold, but that would make it vastly different than anything else they've produced over the years. And MVC? Razor? Anyone who attended MIX11 can tell you that Microsoft once-again attempted to generate interest in them during the conference, efforts that were among the most abysmal failures. No one cared then and no cares now, especially given all that's gone down since then - the relevent days of such things are far, far behind us...

Tue, Jul 26, 2011 Mike Brisbane

Haven't used the converter but Telerik's MVC extensions are gold.

Add Your Comments Now:

Your Name:(optional)
Your Email:(optional)
Your Location:(optional)
Comment:
Please type the letters/numbers you see above

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.