如何从 Visual Studio 2010 制作的调试文件夹中恢复数据/代码?

发布于 2024-12-26 22:06:15 字数 614 浏览 2 评论 0原文

我有一个严重的问题,我的硬盘昨天崩溃了,上面有大量的项目。我丢失了其中的大部分,但我恢复的都是我发送给客户端的调试文件夹(其中大多数是桌面应用程序)。我无法恢复大部分工作的代码,但我确实有调试文件夹,我的问题是有什么方法可以从中恢复我的代码。 我相信您过去一定经历过这种情况,如果您有任何相关信息,请提供帮助。

调试文件夹中的文件:示例我制作应用程序苹果

apple.exe                     type=application
apple.pdb                     type=PDBFIle
apple.vshost                  type=Application
apple.vshost.exe.mainfest     type=MANIFEST File

附加信息:

我的笔记本电脑硬盘崩溃了,所以我目前将其用作另一台笔记本电脑的 USB 驱动器。我有 3 个分区,但现在我看到 4 个 i,j,k,l 。其中一个曾经是我的 D: 驱动器,工作正常,我看到它显示 150 GB 中有 72 GB 可用空间。其余的他们只是没有任何信息,当我点击它们几分钟后,它会说格式化驱动器等...如果你知道如何解决这个问题那就太好了。

谢谢

I have a serious issue, my harddisk crashed yesterday , and i had tons of projects on it .I lost most of them but the ones i recovered are all the debug folders i sent to clients (most of them are desktop applications). I am unable to recover the code for most of the work , but i do have debug folders , my question is is there any way that i can recover my code from them.
I am sure some one you would have gone through it in the past, please help if you have any information regarding this.

Files in the debug folder:Example i make application apple

apple.exe                     type=application
apple.pdb                     type=PDBFIle
apple.vshost                  type=Application
apple.vshost.exe.mainfest     type=MANIFEST File

ADDITIONAL INFO:

My laptop hardisk crashed so i am currently using it as a usb drive with another laptop . I had 3 partitions but now i see 4 i,j,k,l . One of them which used to be my D: drive working fine, i see it shows 72 GB free out of 150 GB. Rest of them they are just there no info, when i click them nothing for minutes then it says format drive etc... If you know how to fix that that would be wonderful.

Thank you

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

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

发布评论

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

评论(1

葬花如无物 2025-01-02 22:06:15

您真的很幸运能够访问包含已编译的二进制文件的调试文件夹。事实上,您使用托管语言 (C#) 工作,这意味着您可以使用众多 .NET 反编译器之一以可读格式显示它们包含的源代码。它可能与您最初在 Visual Studio 中输入的内容不完全一样,但它会非常接近 — 比系统崩溃时通常预期的要好得多。

我曾经推荐 Redgate 的 .NET Reflector 来完成此任务,但他们最近决定取消其免费版本反编译实用程序并采用了一些我个人不同意的商业做法。话又说回来,他们的工具可能仍然是最好的,因此您可以考虑下载他们的 30 天试用版以尝试恢复您的代码。谁知道呢,你可能会非常喜欢它,所以就买了!

如果您像我一样是个小气鬼,或者是真正自由软件的爱好者,您可以尝试 Reflector 变得不免费后出现的免费替代方案之一,例如 ILSpy,由开发 SharpDevelop 的同一个人开发。 此处列出了更多替代方案。

无论您选择哪种反编译实用程序,请下载副本并打开其可执行文件。然后从“文件”菜单中选择“打开”,然后导航到要从中恢复源代码的第一个编译的 .exe。该实用程序将显示您的应用程序的名称以及有关程序集的一些元数据。从这里,您可以确保打开了正确的文件。

在 ILSpy 和 .NET Reflector 中,您可以单击应用程序名称旁边的 [+] 开关来展开其列表。您将看到更多可扩展的项目,例如引用(应用程序使用的 DLL)、资源(编译到应用程序中的资源文件)以及代码中定义的命名空间。展开单个命名空间将显示该命名空间中定义的所有类型,展开类型将显示该类型中定义的所有类型、方法、成员等,依此类推。单击左侧源树中的各个项目将在右侧的输出窗格中显示反编译的代码; ILSpy 和 .NET Reflector 都支持将代码显示为 C#,这对您来说应该非常易读。

例如,使用 ILSpy 打开 ILSpy.exe 应用程序本身会生成以下输出

你真的无法破坏这里的任何东西,所以四处浏览,探索并看看所有的东西都可以恢复,你会惊讶于如何恢复好吧,这有效。 DLL 的一切工作与 EXE 的工作一样好。

然后开始复制和粘贴...

下一个任务是让您的系统再次稳定。如果您遇到过硬盘崩溃,您绝对不想再信任该驱动器!立即用完并购买一个新的,擦除它,然后重新加载 Windows。

完成此操作后,您肯定想要开始设置source/版本/修订控制系统用于将来存储您的代码。所有聪明的开发人员都出于多种原因使用它。通过 Google 搜索查找更多信息。有很多不同的选择。你选择哪一个并不重要;重要的是。重要的是你选一个!

You really lucked out with having access to the Debug folders containing your compiled binaries. The fact that you're working in a managed language (C#) means that you can use one of the many .NET decompilers to display the source code that they contain in a readable format. It may not be exactly the same as what you initially typed into Visual Studio, but it will be pretty darn close—way better than can normally be expected in the event of a system crash.

I used to recommend Redgate's .NET Reflector for this task, but they recently decided to eliminate the free version of their decompiler utility and adopted some business practices that I personally disagreed with. Then again, their tools are probably still the best around, so you might consider downloading their 30-day trial to attempt to get your code back. Who knows, you might like it so much that you buy!

If you're a cheapskate like me, or a devotee to truly free software, you can try one of the free alternatives that cropped up after Reflector became not free, like ILSpy, developed by the same people who develop SharpDevelop. Even more alternatives are listed here.

Whichever decompiler utility you choose, download a copy and open its executable. Then from the "File" menu, choose "Open", and navigate to the first compiled .exe from which you want to recover source. The utility will display the name of your application and some metadata about your assembly. From here, you can make sure that you opened the correct file.

In both ILSpy and .NET Reflector, you can click the [+] toggle next to your application's name to expand its listing. You'll see a bunch more expandable items, like References (the DLLs that your application uses), Resources (the resource files compiled into your application), and the namespaces defined in your code. Expanding an individual namespace will show you all of the types defined in that namespace, and expanding a type will show you all of the types, methods, members, etc. defined in that type, and so on down the hierarchy. Clicking on individual items in the source tree to the left will display the decompiled code in the output pane to the right; both ILSpy and .NET Reflector support displaying the code as C#, which should look very readable to you.

For example, using ILSpy to open the ILSpy.exe application itself produces the following output:

 

You really can't break anything in here, so navigate around, exploring and seeing what all can be recovered, amazed at how well this works. Everything works just as well with DLLs as it does with EXEs.

Then get started copying and pasting...

The next order of business is getting your system stable again. If you had a hard disk crash, you definitely don't want to trust that drive ever again! Run out and buy a new one immediately, wipe it, and reload Windows.

Once you finish with that, you definitely want to get on setting up a source/version/revision control system to use in the future to store your code. All smart developers use this for so many reasons. Find more information with a Google search. There are lots of different options. Which one you pick is not important; the important thing is that you pick one!

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