views:

190

answers:

5

Hi

I have a number of legacy web controls (ascx) that contains huge amounts of inline C#. The forms contain a number of repeated and duplicate code. Our first plan is to move the code into code behinds per file, then refactor etc... were doing this to upgrade the client to the latest version of their cms

At the moment we are going to have to manually copy and paste from hundreds of files, create a code behind, copy the code, add the namespaces based on the client-side imports and then do any tidying up

does anybody PLEASE know of a tool that can do the majority of this work for us ?

Thanks

A: 

I think your best hope here is to create a custom conversion utility. I don't know of any tools that would do this out of the box.

mjmarsh
A: 

Use a language like Perl or Rebol which can do parsing. Rebol is the easiest.

A: 

Resharper has many features for moving and locating code for different refactorings. I don't have it installed on the machine I'm at right now, so can't verify, but it may be able to at least speed up the process and make it more full proof, even if it can't be fully automated.

Nick
+1  A: 

The DMS Software Reengineering Toolkit is designed to support the the construction of automated mass change tools.

It can parse HTML, and C#, (and build corresponding ASTs) and could be configured parse .ascx files. With the parse trees, one could likely generate your desired results. Is this easy? No. is is practical? Yes, if the amount of code you are reengineering is significant, as it seems in your case.

Ira Baxter
A: 

I think your best bet would be to look at the Codesmith tools, or just T4 templates in general..you shouldn't need to write a custom app...though it looks like someone on CodeProject did just that : http://www.codeproject.com/KB/aspnet/InlineCodeVSCodeBehind.aspx?msg=997793

fdfrye