Recovering file from the Visual Studio document ca

2020-02-01 03:31发布

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.

7条回答
Emotional °昔
2楼-- · 2020-02-01 03:48

Visual Studio 2019.4.1 had my backup files in %localappdata%\Microsoft\VisualStudio\BackupFiles - the folders in the MyDocuments tree were empty.

查看更多
叼着烟拽天下
3楼-- · 2020-02-01 03:48

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!

查看更多
不美不萌又怎样
4楼-- · 2020-02-01 03:51

If you have compiled the code into a DLL, then you can use ILSpy, or Reflector to decompile that back into code.

查看更多
手持菜刀,她持情操
5楼-- · 2020-02-01 03:55

Sorted it. Those recovery files are located @ MyDocuments\Visual Studio X\Backup Files\Project Name...

查看更多
男人必须洒脱
6楼-- · 2020-02-01 04:04

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.

查看更多
我命由我不由天
7楼-- · 2020-02-01 04:11

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?

查看更多
登录 后发表回答