反编译 C# Exe,并提供部分源代码

发布于 2024-10-11 08:36:57 字数 223 浏览 8 评论 0原文

我在工作中维护一个 C# 程序,由于硬盘崩溃,我丢失了已部署版本的一大块代码(这是我自己没有经常推送 git 存储库的错),现在我必须做出一些更改程序。我有旧版本程序的源代码,我想反编译 exe 并将其与旧源代码合并以恢复我丢失的代码。

我知道我可以使用反射器等工具进行反编译,但我不想手动将其与旧代码合并,因为这样我就可以再次对更改进行编码(大约需要 1-2 天的工作时间)。这是可能的还是我必须手动检查代码转储?

I maintain a C# program at work and due to a hard disk crash i lost a big chunk of code for an already deployed version (which is my own fault for not pushing the git repository often enough) and now i have to make some changes to the program. I have the source code of an older version of the program and i want to decompile the exe and merge it with the older source to restore the code i lost.

I know i can decompile with tools like the reflector, but i don't want to merge it with the old code by hand, as i then could just code the changes again (about 1-2 days of work). Is that possible or do i have to go through the code dump manually?

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

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

发布评论

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

评论(2

你没皮卡萌 2024-10-18 08:36:57

我建议你重新编译旧代码,然后用反射器反编译。

然后用反射器反编译当前的可执行文件,并对这两个进行比较。这样你只会看到你所做的更改,并且可以将这些更改应用到旧的源代码中,而不是仅仅在反编译的代码和原始源代码之间进行比较 - 这显然会产生大量无趣的差异(评论,对于一件事!)。

老实说,我看不出还有什么比这更好的了。当然,这将是一个手动过程,但仍然可以节省您一些时间。

I suggest you recompile the old code, and decompile that with reflector.

Then decompile the current executable with reflector, and diff those two. That way you'll only see the changes you made and you can apply those to your old source code, rather than just taking a diff between decompiled code and the original source - which will obviously throw up huge amounts of uninteresting differences (comments, for one thing!).

I can't see how it would get better than that, to be honest. It will be a manual process of course, but it should still save you some time.

GRAY°灰色天空 2024-10-18 08:36:57

我不得不这样做一次,我推荐 Dis#。

编辑:
现在,ILSpy 好多了

I had to do this once, I recommend Dis#.

Edit:
Now, ILSpy is much better

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