反编译 C# Exe,并提供部分源代码
我在工作中维护一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议你重新编译旧代码,然后用反射器反编译。
然后用反射器反编译当前的可执行文件,并对这两个进行比较。这样你只会看到你所做的更改,并且可以将这些更改应用到旧的源代码中,而不是仅仅在反编译的代码和原始源代码之间进行比较 - 这显然会产生大量无趣的差异(评论,对于一件事!)。
老实说,我看不出还有什么比这更好的了。当然,这将是一个手动过程,但仍然可以节省您一些时间。
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.
我不得不这样做一次,我推荐 Dis#。
编辑:
现在,ILSpy 好多了
I had to do this once, I recommend Dis#.
Edit:
Now, ILSpy is much better