Reputation: 11795
I've just lost some code. I needed to move a couple of methods from one class to another so i hit save, cut the methods and VS crashed. Now it seems that the save happened after the cut since the code has been saved without those methods but the code isn't on my clipboard. So I'm left without the code and no easy way to get it back!
I know that Visual Studio keeps a document cache which it uses when the recover files dialog is shown but it wasn't shown when VS started back up. I'm hoping that there is a version of my class with the code still in there so i don't have to start again but i don't know where to look.
Can anybody tell me where VS keeps these files on disk?
Really appreciate ANY help you can offer.
Upvotes: 41
Views: 120165
Reputation: 11795
Sorted it. For VS 2017, those recovery files are located @ MyDocuments\Visual Studio X\Backup Files\Project Name...
Upvotes: 81
Reputation: 11
Found my files after searching everywhere... I ended up here: C:\Users[me]\AppData\Roaming\Microsoft\SQL Server Management Studio\18.0_IsoShell\AutoRecoverDat
And so opened that data file which led me to the correct paths for where my files were backed up C:\Users[me][OneDrive]\Documents\Visual Studio 2017\Backup Files\Solution1
Upvotes: 0
Reputation: 11
Found my files after searching everywhere... I ended up here: C:\Users[me]\AppData\Roaming\Microsoft\SQL Server Management Studio\18.0_IsoShell\AutoRecoverDat
And so opened that data file which led me to the correct paths for where my files were backed up C:\Users[me][OneDrive]\Documents\Visual Studio 2017\Backup Files\Solution1
What is strange is I went to the above, after checking our new One Drive and seeing nothing, and I did not see my files at the above path. So not sure if I had to open the data file to make them become visible or I just did not notice them when I first checked that path.
Upvotes: 1
Reputation: 83
It's actually simple. Open Command Pallette in VS code by Typing Ctrl Shift P, Mac I assume cmd Shift P. Then search "local history" you should see revert entry ... then a pop up will show up select the file to revert. You will see the code there.
Upvotes: 4
Reputation: 11
For those finding this after deleting files and using Visual Studio (2019, professional in my case) and none of the above working, I managed to find some intellisense backups in:
%appdata%\Local\Temp\VSFeedbackIntelliCodeLogs\Suggestions\XXX\output\versions
Where XXXX is the nearest time in which you were working on the deleted files.
One of my missing files was there in it's entirety, another did have some bits missing but it's far better than the alternative.
Upvotes: 0
Reputation: 331
Running on Ubuntu 18.04, with VS code 1.51.0
My VS Code deleted files are located at: ~/.local/share/Trash/files
To search for your deleted files:
find ~/.local/share/Trash/files -name your_file_name
Hope my case helped!
Upvotes: 0
Reputation: 8798
Visual Studio 2019.4.1 had my backup files in %localappdata%\Microsoft\VisualStudio\BackupFiles
- the folders in the MyDocuments tree were empty.
Upvotes: 65
Reputation: 163
For Linux, the location seems to be ~/.config/Code/Backups/
(found the info here: https://github.com/Microsoft/vscode/issues/3884)
Good luck recovering your files, future travellers! I got lucky!
Upvotes: 2
Reputation: 125
This is a known bug in VS and is being continually ignored by Microsoft. I've lost full day's worth of work as a result. The solution that worked for me was to move my project to a GoogleDrive sync folder. Now every time I save files, Google drive syncs a copy to the cloud. Along with regular commits to Git, I should never have to loose work.. sigh
Upvotes: 2
Reputation: 502
I came here looking for an answer to the same issue, but none of these things helped -- that being said, in visual studio 2010 deleted files end up in the Windows Recycle bin.
Here's another post talking about the same thing: How do I recover a deleted item from Visual Studio 2010?
Upvotes: 8
Reputation: 37172
If you have compiled the code into a DLL, then you can use ILSpy, or Reflector to decompile that back into code.
Upvotes: 14
Reputation: 20043
It doesn't help you now, but you might want to install ClipX, which helps keep as many items on the clipboard as you'd like. It's helped me in times when the crash happened, but there was a version on the clipboard awhile back.
Upvotes: 1