views:

972

answers:

8

Somebody please tell me it is possible to recover Visual Studio source after VS crashes!

I have just spent 5 hours writing a new utility app, and running it with the "Save before Build" option turned on, as well as AutoRecover every 5-mins. But after VS crashed I am unabled to find anything other than an empty project folder!!! I can't believe that files are only "saved" to memory?!? That can't be right! That 5 hours of work has to be somewhere on the disk?

I attempted to reproduce the scenario by creating a Junk project, running it, and then killing VS using Task Manager. It wasn't quite the same situation as a dialog box actually popped up asking to save the project. I ignored this and continued the kill. I was then able to find the Junk source in C:\Users{Username}\AppData\Local\Temporary Projects as advised - but not my earlier project.

I think it's gone.

A: 

Until you actually hit save solution, the project is saved in a temporary directory. This allows you to create quick scratch projects and not clutter up your projects folder. Hopefully it hasn't been cleaned up yet, but if not, it will be in you application data directory. On Vista, that is

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

Sorry, I forget what that was on XP.

Moral of the story, if it's not a scratch project, save the project early.

Rob Prouse
Where is the folder in XP?
Jeff
A: 

Indeed it does. Check your two projects folders. Both may contain your project and yet one is a folder with nothing but a .sln file in it.

I'm very confident your work is on your disk somewhere in your Documents folder :). If all is set to defaults.

Robert
+3  A: 

In order to make sure this doesn't happen again in the future, you can go to

Tools > Options > Projects and Solutions

and check the item

Save new projects when created

Kyralessa
A: 

I recovered a source file saved in

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

(this was on Vista)

Brian
A: 

grep/search your entire drive for sln, proj and cpp (or whatever language) files.

good luck.

Tim
+1  A: 

I got the same problem as the poster. I ran (and thus implicitly saved) the project several times, but apparently the source is gone.

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

Only contains an empty folder with the project name

C:\Users{Username}\AppData\Local

Does not even contain a folder named Temporary Projects

I searched all of C: and found nothing relevant.

Klas Mellbourn
A: 

If you ever want VS Management Studio files, I just found mine in "C:\Users\<>\Documents\SQL Server Management Studio\Backup Files\Solution1\" as ~AutoRecover% files...

SAinCA
A: 

I found my files at ..\Visual Studio 2008\Backup Files\\~AutoRecover. Fortunately for me, I have set the Auto Recover timeout option to 3m, so I did not lose anything.

PHEW!!

WeMoecke