Recover .CS Class File After Failure

I was working on a class in visual studio 2010 when the computer suddenly crashed. after rebooting the computer. I am running Visual Studio and I believe that the class will be completely empty. it contained more than 1000 lines of codes before the class. is there anyway i can restore this file?

Please help, because I do not have another copy (stupid from me)

+10
visual-studio-2010
source share
6 answers

If you cannot find the source file, try using Reflector to decompile a newly created DLL containing this class. This will not give you your complete source, but at least it will give you something to start with.

Note. The reflector is no longer free; If this is important, try dotPeek from JetBrains.

Also learn about using a source code management system . This will allow you to “copy” versions of your code into the repository, so you will have a copy if something like this happens in the future.

Subversion , Git , Mercurial are popular; In my opinion, Subversion will be the easiest to start, especially with TortoiseSVN (OS integration) and AnkhSVN (Visual Studio integration). If you don’t want to worry about setting up a repository / server, look at a hosted solution, such as Beanstalk , which offers Subversion and Git, and you can try it with a free limited account.

Good luck - I hope you can restore your source!

+19
source share

Something that worked for me was a backup. BTW I tried to restore the VS2013 file on a machine running Windows 8.

Try registering below on your system.

C: \ Users \ username \ My Documents \ Visual Studio \ Backup Files \ ProjectFolder

I found the source file named original-date.filename.cs and the files recovered-date.filename.cs.

The original was needed. Deleted the file in the project, added the source file and renamed it to a .cs file. I tried to build and debug, and it gave the expected results.

+8
source share

Also just want to add one more thing ... In my case, I had an aspx page with its corresponding .cs and designer.cs .cs file was corrupted and I built the project and the designer.cs project was successfully created and the dll was replaced . And when I tried to restore the reflector, everything was in a state of no return. :(

Therefore, do not create a project if you see that any file is damaged.

+4
source share

This also happened to me several times when Visual Studio crashed or the system shut down unexpectedly. You can repair this damaged file with Recuva . It does not restore the file every time, but in most cases it works fine.

The following are the options that you must configure before restoring.

  1. Launch Recuva. Enter advanced mode if the wizard starts.
  2. Press Options.
  3. In the Options dialog box, click the Actions tab.
  4. Click Scan for files that are not deleted, and then click OK.
  5. Run a Recuva scan as usual. Files that are not deleted are indicated by a green double circle status icon.

I hope you find your damaged file in the recovered files, as it restores several versions for this file.

0
source share
0
source share

in visual studio 2019 i find file in files with tmp extension

FileName.cs ~ xxxxxxxx.TMP

0
source share

All Articles