4

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? Help please.

Thanks.

Sangam Uprety
  • 1,482
  • 2
  • 20
  • 38

6 Answers6

5

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.

Mishax
  • 4,442
  • 5
  • 39
  • 63
  • I just made this exact mistake but thankfully Visual Studio didn't override the backup project and I could recover it in time. I wouldn't have known what could have happened without this answer. Thank you so much for pointing this out, though!! – Brixster May 05 '20 at 20:26
4

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.

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
4

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

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
Jon
  • 2,502
  • 4
  • 21
  • 23
  • Thanks for the link. Now I have come to know that I can backup my files for future recovery. But for now, when I checked the backup files folder, those are empty for both visual studios 2005 and 2010. I wonder why? – Sangam Uprety Jun 08 '11 at 04:36
  • I had this problem and the originals were fine but the recovered versions were very corrupted. Thanks for the link. – ruffrey Jun 05 '13 at 19:10
  • Thank you! this saved me one hour of extreme refactoring. My recovery file would always open up with notepad and as a binary file after system had a BSOD. I recovered it manually from the above location. – Saurabh Feb 02 '16 at 19:36
3

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.

Captain overflow
  • 312
  • 2
  • 11
  • Please also see my answer. The files remain after a restart (especially for Visual Studio 2010) but you have to do things in the right order. – Mishax Oct 09 '16 at 19:08
0

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.

Andrey Moiseev
  • 3,914
  • 7
  • 48
  • 64
0

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