A tool to convert embedded C # to code after file

I have several legacy web controls (ascx) that contain a huge amount of inline C #. Forms contain several repeating and repeating codes. Our first plan is to move the code to the code behind each file, then refactoring, etc. .... did this to update the client to the latest version of their cms

At the moment, we will have to manually copy and paste hundreds of files, create the code behind, copy the code, add namespaces based on import on the client side, and then do some tricks

Does anyone PLEASE know about a tool that can do most of this work for us?

thanks

+4
source share
5 answers

DMS Software Reengineering Toolkit is designed to support the creation of automated tools for bulk changes.

It can parse HTML and C # (and build appropriate ASTs) and can be configured to parse .ascx files. With parsing trees, you can probably generate the desired results. Is that easy? Not. Practically? Yes, if the amount of code that you reengineered is significant, as it seems in your case.

+1
source

I think your best hope here is to create a special conversion utility. I do not know any tools that could do this out of the box.

0
source

Use a language such as Perl or Rebol that can perform parsing. Reball is the easiest.

0
source

Resharper has many functions for moving and defining code for various refactoring. I don’t have it on the computer on which I am now, so I can’t check it, but it can at least speed up the process and make it a more complete proof, even if it cannot be fully automated.

0
source

I think it's best to look at Codesmith tools or just at T4 templates in general. You do not need to write your own application ... although it looks like someone from CodeProject did just that: http://www.codeproject.com/KB/aspnet/InlineCodeVSCodeBehind.aspx?msg=997793

0
source

Source: https://habr.com/ru/post/1303835/


All Articles