Menu: Tools -> Options -> Environment -> AutoRecover
WARNING: Read the comments associated with this post as there are multiple complaints that this features doesn’t work as expected. Read this thread from the engineering folks about usage with versions VS2010 and older.
Perhaps your best friend is the AutoRecover feature. It can be a real life saver if the dev environment crashes or there is a power outage or a meteor hits your cube (okay, maybe not that last one). It’s very simple to use, just go to Tools -> Options -> Environment -> AutoRecover:
If you want to turn this feature off you can deselect the “Save AutoRecover information every” checkbox. Of course, if you do this we will all laugh at you when you lose important work because you didn’t have it and I will personally blog about it so everyone knows–you might want to leave it on–just saying. Here is what the other options do:
X minutes – determines how often files have AutoRecover information saved. The default is 5 minutes but you can adjust up or down depending on usage. There is an inverse relationship between this value and the frequency of your updates to code. If you make more frequent updates to code then have a lower number here. Fewer updates to code mean you can increase this number if you desire. If you are going to make a mistake here make it on the side of a number that is too low rather than too high. It’s better to take any performance hit from file I/O than to lose a ton of work.
X days – used to decide how long AutoRecover files are kept in the Backup Files directory. The default is 7 days which is usually adequate for most situations. If you work with a lot of projects over a short period of time then you may want to decrease this number to keep the Backup Files directory more clear. If you are going to guess on this value then it’s better to guess high and lower the number as needed.
Let’s be clear on what a is exactly saved and where it is saved. First, recovered files are stored at \…\My Documents\Visual Studio <version>\Backup Files\<projectname>. Not every file is saved here. Let me show you an example:
Here is the backup folder for one of my solutions when I create it in Visual Studio:
Obviously the folder is empty. Now let me make a change to a file and save the change. Then I’ll wait 5 minutes to see the result:
Still nothing because there is no need to recover a saved file. But let me make a change to a file without saving it and wait another 5 minutes:
NOW we have AutoRecover information because if there is crash we will have to make a decision to recover the unsaved changes or keep the last saved version. This is essentially the function of AutoRecover.
When you do finally have to recover a file, this is the dialog you will get:
Recovered files – lists the file(s) that can be recovered with a a checkbox to select/deselect the file as well as basic information.
<File Name> Summary – shows detailed information about the currently selected file including date/time info, location of the backup file, and destination location where the file will be recovered to.
Recover Selected Files – performs a recovery action on the file(s) selected copying the recovered source file to the previously indicated destination.
Do Not Recover – closes the dialog box without recovering any of the files listed.