Visual Studio 在突然崩溃时丢失了当前代码

发布于 2024-11-14 04:30:14 字数 240 浏览 5 评论 0原文

当一些粗心[有点疯狂]错误地按下开始按钮时,我的 Visual Studio 2010 崩溃了,我的 Acer 时间线变得不稳定。当时打开了两个项目,其中一个在 Visual Studio 2005 中打开 [我安装了 2005 和 2010]。不幸的是,我丢失了当时完成的所有代码以及几周前编写的代码。现在,两个解决方案中的项目文件都比这几周旧了。令人惊讶的是,.aspx 页面完好无损,而 .cs 文件却消失了。

可以采取什么措施来获取丢失的数据?

My visual studio 2010 crashed when some carelessness [bit of madness] mistakenly pressed start button and my Acer timeline got unstable. Two projects where open at the time, one in visual studio 2005 [I have both 2005 and 2010 installed]. Unfortunately I lost all the codes I had done at the time along with those coded even weeks before. Now the project files in both the solutions are those weeks older. Amazingly, the .aspx pages are intact and .cs files are gone.

What can be done to get the lost data?

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

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

发布评论

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

评论(7

深海夜未眠 2024-11-21 04:30:14

如果您的 Visual Studio 崩溃,请注意,您需要在重新启动 Visual Studio 之前检查备份并检查您的文件是否正常!许多人抱怨崩溃后失去了工作,然后重新启动 Visual Studio,发现在 Visual Studio 中找不到他们的代码,然后检查位置

%USERPROFILE%\Documents\Visual Studio 2010\Backup Files 的 备份\\

顺序很重要。在重新启动 Visual Studio 之前,请先检查备份。如果启动 Visual Studio,然后打开旧项目,Visual Studio 可能会覆盖该项目的备份文件。

确保备份安全是您首先关心的问题。然后启动 Visual Studio 并打开您的项目以查看损坏程度。

Guys TAKE CARE if your Visual Studio crashes, you need to check the backup BEFORE you restart Visual Studio and check if your files are ok! Many people complain that they lost work after a crash, and then they restart Visual Studio, and upon discovering that their code cannot be found in Visual Studio they then check the backup at the location

%USERPROFILE%\Documents\Visual Studio 2010\Backup Files\\

The order is important. Check the backup FIRST, before restarting Visual Studio. If you start Visual Studio and then open your old project it's probable that Visual Studio will overwrite the backup files for that project.

Securing the backup is your FIRST concern. Then start Visual Studio and open your project to see how much damage there is.

折戟 2024-11-21 04:30:14

您可以检查:

C:\Users\<username>\Documents\Visual Studio 2010\Backup Files\<ProjectName>\
C:\Users\<username>\Documents\Visual Studio 2005\Backup Files\<ProjectName>\

更多信息可以在这里找到:
Visual Studio 2010 自动恢复功能

You can check:

C:\Users\<username>\Documents\Visual Studio 2010\Backup Files\<ProjectName>\
C:\Users\<username>\Documents\Visual Studio 2005\Backup Files\<ProjectName>\

More information can be found here:
Visual Studio 2010 AutoRecover Feature

稀香 2024-11-21 04:30:14

我也有过同样的经历——在 BSOD 期间丢失源文件。很烦人!

找不到备份文件,我在硬盘上搜索了包含类名的文件,但没有找到任何备份。

不过,我可以通过使用 DotPeek。因此,如果您之前已经成功编译了代码,则可以通过反编译获得代码(没有注释,并且带有一些奇怪的局部变量名称等)。

I just had the same experience -- losing a source file during a BSOD. Very annoying!

No backup file could be found, and I searched the hard drive for a file containing the class name, but no backup was unturned.

However I was able to get back something resembling my code by decompiling a DLL from the bin/Debug folder using DotPeek. So if you had previously compiled your code successfully, you can get the code (without comments, and with some weird local variable names, etc) via decompilation.

半仙 2024-11-21 04:30:14

我遇到了同样的问题,由于 BSOD,我丢失了代码。

备份文件夹应该存储未保存的文件,直到您保存删除的文件时才保存它们。

我认为重新启动后它们可能不会保留,因为在我的情况下它是空的。

I Had the same problem, I lost code due to BSOD.

the backup folder should store files not saved until they are saved whenever you save the files there are deleted.

I think that maybe they don't remain after a restart as it was empty in my case.

慢慢从新开始 2024-11-21 04:30:14

Recuva是一个非常好的文件恢复工具。它帮助了我一次,但没有帮助我第二次,因为我注意到数据丢失已经太晚了,所有可恢复的数据都被覆盖了。

所以我使用了DotPeek,虽然你必须对反汇编的文件做很多工作,但它们非常奇怪。

现在我把我的源代码树放在Google Drive中,因为它有文件版本并保留已删除的文件。 Dropbox 也可以。

Git 或任何其他 VCS 都不是这个问题的解决方案,因为你不能有大量无意义的提交。

A very good file recovery tool is Recuva. It helped me once, didn't help me second time, though, because I noticed the data loss too late, and all recoverable data got overwritten.

So I used DotPeek, though you'll have to do a lot of work on the disassembled files, they are pretty weird.

Now I put my source tree in Google Drive, because it has file versions and keeps deleted files. Dropbox would do, too.

Git or any other VCS are not solution for this thing, because you cannot have crazy amount of meaningless commits.

烟若柳尘 2024-11-21 04:30:14

我可以在类似情况下通过使用数据恢复软件恢复此类文件(在我的情况下,AVG Pc Tune Up,有一个恢复已删除文件的选项,它在文件所在的目录中找到了一个 TEMP 文件,其中包含数据,直到最后一次保存,我通过用记事本打开来复制该文件中的内容并添加到我的项目中),
因此,使用数据恢复软件可以解决您的情况

I could recover Such file in a similar situation By Using a data recovery software (in my case AVG Pc Tune Up, has an option to recover deleted files, It found a TEMP file in the Directory where the file was existing Which has data Until the last save, I copied the content in that file by opening with Notepad and Added to my project) ,
So Using a Data recovery Software MAY Solve your Situation

海夕 2024-11-21 04:30:14

可以在 Visual Studio Code 中完成一个月的恢复 1 右键单击​​文件,然后单击“打开时间轴” 3 从时间轴中选择文件 4 您上次保存的文件时间 5 以及您对文件的最后一次更改被恢复

注意:不仅是最后一次,而且所有以前保存的检查点都可以从 VS Code 恢复

注意:答案来自另一个相关线程上的用户“Ashish Gautam”。在这里复制它,以便有人发现它有用。因为它是我的救星。谢谢。

A month recovery can be done in visual studio code 1 Right click on file and 2 click Open Timeline and 3 select file from timeline 4 the last time file saved by you 5 and your last change of the file is recovered

NOTE : Not only last but all the previously saved check points can be recoverd from vs code

NOTE: The answer is from the user 'Ashish Gautam' on another related thread. reproducing it here, so that someone can find it useful. Since its been lifesaver for me. Thanks.

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