将内联 C# 转换为代码隐藏文件的工具

发布于 2024-08-24 23:28:22 字数 223 浏览 3 评论 0原文

我有许多旧版 Web 控件 (ascx),其中包含大量内联 C#。这些表格包含许多重复和重复的代码。我们的第一个计划是将代码移至每个文件的代码隐藏中,然后重构等...这样做是为了将客户端升级到其 cms 的最新版本

目前,我们将不得不手动复制并粘贴数百个文件文件,创建隐藏代码,复制代码,根据客户端导入添加命名空间,然后进行任何整理,

有人知道可以为我们完成大部分工作的工具吗?

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

原谅我要高飞 2024-08-31 23:28:22

DMS 软件重组工具包旨在支持自动化大规模变更工具的构建。

它可以解析 HTML 和 C#(并构建相应的 AST),并且可以配置解析 .ascx 文件。使用解析树,人们可能会生成您想要的结果。
简单吗?不,实用吗? 是的,如果您重新设计的代码量很大,就像您的情况一样。

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.

小忆控 2024-08-31 23:28:22

我认为您最大的希望是创建一个自定义转换实用程序。我不知道有什么工具可以开箱即用地执行此操作。

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.

蓝眼泪 2024-08-31 23:28:22

使用 Perl 或 Rebol 等可以进行解析的语言。雷博尔是最简单的。

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

泅渡 2024-08-31 23:28:22

Resharper 有许多功能,用于移动和定位不同重构的代码。我现在所在的机器上没有安装它,所以无法验证,但它至少可以加快这个过程并使其更充分的证明,即使它不能完全自动化。

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.

拥抱影子 2024-08-31 23:28:22

我认为你最好的选择是查看 Codesmith 工具,或者只是一般的 T4 模板...你不需要编写自定义应用程序...尽管看起来 CodeProject 上的某人就是这样做的: http://www.codeproject.com/KB/aspnet/InlineCodeVSCodeBehind.aspx?msg= 997793

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文