Recover a Visual Studio project that was never sav

2020-08-13 06:27发布

问题:

I started a new project this morning and, after putting ~3 hours of work into it, I tried to open a file from another project to get some code from it. I got a warning about discarding an unsaved object. After telling it to go ahead, I realized that it was referring to the project I had just been working on and not another file that I had just opened.

Even though I never saved the project, the various files containing my code and dataset had to exist on the hard-drive. Are they still there, perhaps in a temp folder? I'm developing on a box running Server 2008 R2 (don't ask, not my decision :) ).

回答1:

This may help: http://blogs.msdn.com/b/saraford/archive/2008/02/14/did-you-know-where-visual-studio-saves-auto-recovered-files-in-the-case-of-an-unexpected-shutdown-151.aspx

Also check C:\Users{Username}\AppData\Local\Temporary Projects

You could try one of those undelete programs and see if it finds anything.

Tools > Options > Projects and Solutions

and check the item

Save new projects when created

Save frequently. :)



回答2:

Need to give one related input. Who the hell had the idea to implement this feature???

I used Visual Studio until 2003, then came back again to 2010 now. After 2 days work, saving all the time, as I used to (Ctrl + S), I close the project and decide not to save the solution itself.

Done. All lost. Nothing can be recovered from anywhere in the computer.

How can a developer implement a dumb idea such as dropping all work in an "in memory" project. You either know about it already or you will get screwed; like thousands found on Google during my desperate search.

Did Microsoft VS team look at it at least? So frustrating...



回答3:

It might be worth checking out the folder where AutoRecover files are saved.

You can find the default file location in Visual Studio on the Tools - Options menu. Look in the Projects and Solutions section - expand that and look in General to find the default file locations.

My files were under C:\My Documents\Visual Studio 2008\Backup Files.



回答4:

I had this happen to me this morning. I worked on a new project yesterday and windows ran an update last night. Despite having debugged my program - the project had not saved - for some reason it didn't occur to me that the project might not be saved. I left the program running on my computer when I went to bed. This morning when I work up, I saw that windows had run an update. A few hours later, I saw that my computer had no trace of my program. I realize this is an old post, but I thought I would shed some light on what I did, since i was able to recover my files.

First I went here: http://windows.microsoft.com/en-us/windows7/recover-lost-or-deleted-files

In Visual Basic 2010 Express, a backup folder is created with your project name. Sure enough, my project backckup folder was there: Documents\Visual Studio 2010\Backup Files\MyProject. But, the folder was empty. I "restored this folder to a previous version" using the steps listed in the link above. After doing that, the folder was still empty, BUT, the temporary folder "C:\Users{Username}\AppData\Local\Temporary Projects" now contained my project's folder and files. Prior to running the "restore to previous version", the temporary projects folder was also empty.

So, I was able to copy the folder out of the Temporary Projects folder and I am as happy as one can be - or close to it.

Hope that helps someone out.



回答5:

A note to the answers above, I had a mini jumpscare when i could not find my project anywhere, not in the recent projects nor in the visual studio projects folder.

I eventually found the project in the visual studio projects folder of the admin user;

I was looking at:

C:\Users\LocalUser\Documents\Visual Studio 2015\Projects

Whilst the project was saved under:

C:\Users\LocalAdmin\Documents\Visual Studio 2015\Projects

Bottom line is; also check the \documents of the admin user. This likely happend because i was testing an admin only application and visual studio was running with the admin's user profile loaded.