Just got a random bsod on my machine and Form1.cs is suddenly empty, any way to restore the code? thanks..
For previously saved files, Visual Studio saves a copy of the file in %LocalAppData%\Microsoft\VisualStudio\BackupFiles\[projectname]. If the file is new and you haven't saved it yet, Visual Studio autosaves it by using a randomly generated file name.
Creating a backup of current solution or project is easy, and it's done directly inside VisualStudio: right-click on the solution and select "Backup solution..." right-click on a project select "Backup project..."
You could check C:\Documents and Settings\UserName\My Documents\Visual Studio 2010\Backup Files\
(or the equivalent on your system).
Files will be placed there if auto-recover is enabled, which I believe it is by default. If you want to check that feature is enabled, follow the steps here: http://blogs.msdn.com/b/zainnab/archive/2010/06/30/autorecover-vstipenv0019.aspx
Another top tip is to set 'Save all changes' before building. That setting is in Options, under Projects and Solutions / Build and Run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With