将 ASP.NET 源代码与已编译的 Web 应用程序相匹配

发布于 2024-07-26 16:51:14 字数 1437 浏览 5 评论 0原文

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

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

发布评论

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

评论(4

诗酒趁年少 2024-08-02 16:51:14

我已经在客户项目中多次这样做过,并且像其他评论者一样使用 Reflector。 这种事情发生的次数超出了应有的范围。 例如,当有人突然离开开发团队时。 在一个项目中,在整个开发团队离开后,我的承包商团队被召集进来,我们必须对生产中运行的每一段代码都遵循这个过程,以确保我们手上实际有什么。

我处理这个问题的方法是,将可用的编译代码的每个版本放入文件系统中的单独区域中。 这包括处于源代码管理或开发工作站之外的版本。 这很重要,因为 Reflector 看到的是 IL,而不是实际的原始来源,并且您想要进行逐个比较。

我使用 FileDisassembler for Reflector 将每个二进制文件反编译到单独的文件夹中。 我最终得到一个看起来像这样的结构:

ProjectXyzReconciliation
|-production
|-staging
|-test
|-qa
|-devworkstation
|-sourcecontrol
|-reconciled (this is what will eventually go back in source control)

然后我使用 WinMerge(但同样很好地使用了其他合并/比较工具)来比较目录并将它们合并到“已协调”文件夹中。 我通常会用生产中运行的内容来填充它,然后将所有其他版本与它进行比较。

第一步实际上只是查看不同之处,反编译为文件可以让您使用 WinMerge 等工具来获取实际不同之处的报告,以做出决策。

有时,此过程会产生一两个更改,这些更改很容易追溯到错误跟踪数据库或电子邮件等中的错误,并且可以决定是否应该进入或保留以进行进一步的工作。

当每个差异都得到解释并合并或拒绝以便以后重新工作或删除时,新协调的代码将用作未来开发和重构的新基础。 这确实会丢失代码中的任何注释,但是当整个过程是必要的时,坦率地说,丢失注释并没有多大损失。

第一次完成时,这似乎令人畏惧,但我的团队成员在这方面做得很好,他们发现在后来的项目中,他们常常看起来像是英雄,因为在出​​现恶劣情况时能够看似完成不可能的任务,从而使其成为英雄。值得将其放入您的工具箱中。

I've done this on client projects multiple times and use Reflector, like other commentors. This kind of thing happens more often than it should. For instance, when someone leaves the development team suddenly. On one project, my team of contractors was called in after the ENTIRE development team left and we had to follow this procedure on every single piece of code running in production to be sure of what we actually had on our hands.

The way I deal with it is this by taking EVERY version of the compiled code that's available into a separate area in the filesystem. This includes the version that's in source control or off of the development workstation. This is important because Reflector sees the IL and not the actual original source, and you want to compare apples to apples.

I use the FileDisassembler for Reflector to decompile each of the binaries into a separate folder. I end up with a structure that looks something like this:

ProjectXyzReconciliation
|-production
|-staging
|-test
|-qa
|-devworkstation
|-sourcecontrol
|-reconciled (this is what will eventually go back in source control)

I then use WinMerge (but have used other merge/comparison tools equally well) to compare the directories and merge them into the "reconciled" folder. I usually populate that with what's running in production to start with and compare every other version against it.

The first pass is really just to see what's different and decompiling out to files lets you use tools like WinMerge to get reports of what's actually different for making decisions.

Sometimes, this process yields one or 2 changes that are easily traceable to bugs in the bug tracking database or emails, etc. and decisions can be made as to whether it should go in or stay out for further work.

When every difference is explained and either merged or rejected for later re-work or removal, the newly reconciled code is used as the new base for future development and refactoring. This does lose any comments that were in the code, but when this whole procedure has been necessary, the losing the comments hasn't been much of a loss to be frank.

The first time through, this can seem daunting, but members of my teams that have gotten good at this have found that on later projects, they can often seem the hero for being able to seemingly accomplish the impossible when a nasty situation arises, making it worthwhile to get this into your toolbox.

染火枫林 2024-08-02 16:51:14

如果我处于您的情况,我会一次编译 4 个单独的源项目中的每一个...然后运行 ​​.NET Reflector 的 diff 插件,以查看是否与生产程序集匹配。 如果没有,请编译下一个源项目并再次尝试比较。

If I were in your situation, I would compile each of the 4 separate source projects one at a time... Then run the diff add-in for .NET Reflector to see if you have a match with the production assembly. If not, compile the next source project and try the diff again.

暖树树初阳… 2024-08-02 16:51:14

如果您的项目目录包含 DLL 和 EXE 等构建工件,您可以检查版本号并与生产中的版本号进行比较。 即使您没有获得完全匹配的内容,您也会看到最接近的内容。

If your project directories contain build artifacts such as DLLs and EXEs, you could check the version numbers and compare with those in production. Even if you don't get an exact match, you'll see what might be closest.

梦里的微风 2024-08-02 16:51:14

.NET Reflector 是一个方便的工具,可以查看给定服务器上正在使用哪些代码。

.NET Reflector is a handy tool to see what code is being in use at a given server.

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