Recover deleted project in visual studio - visual-studio

I was creating a website using visual studio and accidentally deleted that project folder. :(
It was three months project. Is there anyway to get it back? visual studio 2013

Are you using any Source control management system (e.g. SVN, git etc...)?
If so, this is the time for a revert. If not, you should...
Was the project deleted from your disk? If not (it shouldn't..),
just re add it to your solution. Chances are it is still in your solution folder
(You can easily open it via Visual studio).
If it was deleted from your HDD, this is where things starts to get tricky. Try restoring deleted data from your disk.
You will need a software to help you with this task (e.g. this one was randomly selected using a simple google search).
In case nothing of the above works you can take your HDD to a professional lab to restore the deleted data.
If it is just a small project, I wouldn't bother. If it is not, Shame on you for not using SCM ;0)
Good luck...
If nothing of the above works, I am sorry for your loss...

Related

Visual Studio: Syncing Projects with OneDrive and "Having the mark of the web"

I develop a few small projects in Visual Studio solo and for my needs using a repo like GitHub or Azure Repos just seems a little over the top. I therefore save my projects to OneDrive and develop my projects and when ready to publish and move onto the next build, just copy the existing project directory for version control and start work on to the next version.
However quite often I get stung when building projects
Couldn't process file <file>.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file. Remove the mark of the web if you want to process these files.
I then have to copy the director out of OneDrive to an unsynced area such as C:\Temp and it builds just fine but then has the issue of remembering to copy back my modified project once done. There seems to be no clear cause of it and the file properties does not have the usual 'Unblock' option:
Has anyone come across this with OneDrive, or any suggestions as to why it's happening? I'm sure the main suggestions would be use a repo solution but this method works just fine for me other than this issue so I'd ideally like to get a solution using OneDrive.
Edit: To confirm I've added my OneDrive path into the Visual Studio trusted locations area and tried adding file://[pc-name] into my local intranet trusted addresses area without any success.
My problem is IDENTICAL to yours. I have tried adding the pc to the safe sites list, I've tried adding to trusted location, I don't have the unblock checkbox that many people mention, I also tried using a powershell script to unblock the file. No luck. The only solution was to do a repair of Visual Studio. That fixed the issue for me so that it stopped happening.

Opening solution using Visual Studio 2017

I have been working on this little mobile app for android using Xamarin in Visual Studio 2017.
When opening the solution with the laptop that I used to develop the app works like a charm. Then I zip the entire folder over the solution.
../myFolder/
app1/ //here is all the code
app1.sln //solution file
myFolder.zip
Transfer the zip file to other laptop/PC through usb, email and online repository, even extensions like rar, 7zp and tar. I simply can not load the solution from other Visual Studio but the one where I created/developed the application originally.
Hours passing with this screen then VS is not responding and after that, it simply crashes/closes with no error message.
In the other hand, I can open any solution created from any other PC in my laptop without issues. After saving, I haven't found the pattern yet, but some solutions can't be opened from the original PC which creates them nor others.
You may be using an older version of Visual Studio on the PC you've facing the issue. I've faced that too.
It was a known bug (reported here and here) already fixed on newer versions.
The workaround is to close VS, delete the folder vs created in the same directory of your solution and try to reopen it.
To avoid other problems on compiling or running your app after that, I recommend you also to delete all bin and obj folders from your project's folders, clean and rebuild the solution.
It's safer keep all your development environments updated in software wise to avoid this kind of trouble.
I hope it helps.

Recovering lost Visual studio 2010 solution after VS update

I worked a few hours building a new solution in Visual Studio 2010 (C#). Created the solution, built and debugged a bunch of times, saved regularly using ctrl+S... AutoRecover is set to save every 5 minutes as well.
Windows was installing a VS 2010 update and rebooted automatically, forcing a shut down.
On restart, the whole solution was gone. The only traces I can find are an empty folder with the solution's name in the "backup" folder and 2 early built located in "C:\Users\USERNAME\AppData\Local\Microsoft\VCSExpress\10.0\ProjectAssemblies\fh5gnjqk01" which I think were created when the build failed.
Is there any chance that newer files are still there somewhere in some temp folder or something, or should I just consider it lost and move on? Since I built and debugged the solution, I suspect there must be a newer ".exe" somewhere that I could reuse with reflector if nothing else.
If not, what should I do in the future to guarantee that the solution is really saved on the disk?

Recover a .CS class file after crash

I was working on a class in visual studio 2010 when suddenly my computer crashes. after I restart the computer. I start Visual studio and I find that class to be completely empty.
it contained more than 1000 lines of codes before the class.
is there anyway i can recover that file?
Help please because I don't have another copy of it (Stupid of me)
If you cannot find the source code file, try using Reflector to decompile the most recently built dll you have containing that class. It won't give you your complete source, but at least will give you something to start with.
Note: Reflector is no longer free; if that matters, try dotPeek from JetBrains instead.
Also, look into using a source code control system. This will let you 'commit' versions of your code to a repository, so you'll have a copy in case something like this happens in the future.
Subversion, Git, and Mercurial are popular ones; In my opinion, Subversion would be the easiest to start out with, especially with TortoiseSVN (OS integration) and AnkhSVN (Visual Studio integration). If you don't want to worry about setting up a repository/server, look into a hosted solution, like Beanstalk, which offers Subversion and Git and lets you try it out with a free, limited account.
Good luck - I hope you are able to recover your source!
Something which worked for me was back-up.
BTW I was trying to recover a VS2013 file on a Windows 8 machine.
Try to check in below location in your system.
C:\Users\username\My Documents\Visual Studio \Backup Files\ProjectFolder
I found an original file with original-date.filename.cs name and a recovered-date.filename.cs files.
The original was the one needed.
Deleted the one in project, added the original file and renamed it to file.cs. Tried building and debugging and it gave the expected results.
Also just want to add one more thing...
In my case i had an aspx page with its respective .cs and designer.cs
The .cs file got corrupted and I did build on project, with the designer.cs the project got build successfully and the dll got replaced. And when i tried to recover using reflector everything was in a state no return. :(
So don't build the project if you see any file got corrupted.
in visual studio 2019 I find the file in a files with TMP extension
FileName.cs~xxxxxxxx.TMP
This happened to me a few times as well when Visual Studio was crashed or System was shutdown unexpectedly.You can recover these corrupted file using Recuva. It dose not recover the file every time but in most of the cases it's work perfectly.
Below are the settings which you need to configure before recovery.
Start Recuva. Enter Advanced mode if the Wizard launches.
Click Options.
In the Options dialog box, click the Actions tab.
Click Scan for non-deleted files, and then click OK.
Run the Recuva scan as normal. Non-deleted files are indicated with a green double-circle status icon.
Hopefully, you will find your corrupted file in recovered files as it recover multiple versions for that file.
Very useful question. I got issue of file crash on sudden shutdown of my PC. recovered file using "Recuva"(download link: https://filehippo.com/download_recuva/) software. Scan for non-deleted files was helpful.
I got help from: https://www.samnoble.co.uk/2014/11/30/visual-studio-crashes-and-a-corrupted-cs-file/
Well, that happen recently for me and I did get my file back this way.
1. Find the project DLLs in the bin folder. Example MySolution.dll
2. Download and Install .Net Reflector from https://www.red-gate.com/products/dotnet-development/reflector/trial/thank-you
3. Open the .Net Reflector app and click the open folder icon then move to your bin directory and select MySolution.dll file
4. Then traverse and expand through your namespaces and classes to look into your codes.
5. Have fun!

Recover a Visual Studio project that was never saved

I started a new project this morning and, after putting ~3 hours of work into it, I tried to open a file from another project to get some code from it. I got a warning about discarding an unsaved object. After telling it to go ahead, I realized that it was referring to the project I had just been working on and not another file that I had just opened.
Even though I never saved the project, the various files containing my code and dataset had to exist on the hard-drive. Are they still there, perhaps in a temp folder? I'm developing on a box running Server 2008 R2 (don't ask, not my decision :) ).
This may help:
http://blogs.msdn.com/b/saraford/archive/2008/02/14/did-you-know-where-visual-studio-saves-auto-recovered-files-in-the-case-of-an-unexpected-shutdown-151.aspx
Also check C:\Users{Username}\AppData\Local\Temporary Projects
You could try one of those undelete programs and see if it finds anything.
Tools > Options > Projects and Solutions
and check the item
Save new projects when created
Save frequently. :)
Need to give one related input. Who the hell had the idea to implement this feature???
I used Visual Studio until 2003, then came back again to 2010 now.
After 2 days work, saving all the time, as I used to (Ctrl + S), I close the project and decide not to save the solution itself.
Done. All lost. Nothing can be recovered from anywhere in the computer.
How can a developer implement a dumb idea such as dropping all work in an "in memory" project.
You either know about it already or you will get screwed; like thousands found on Google during my desperate search.
Did Microsoft VS team look at it at least?
So frustrating...
It might be worth checking out the folder where AutoRecover files are saved.
You can find the default file location in Visual Studio on the Tools - Options menu. Look in the Projects and Solutions section - expand that and look in General to find the default file locations.
My files were under C:\My Documents\Visual Studio 2008\Backup Files.
I had this happen to me this morning. I worked on a new project yesterday and windows ran an update last night. Despite having debugged my program - the project had not saved - for some reason it didn't occur to me that the project might not be saved. I left the program running on my computer when I went to bed. This morning when I work up, I saw that windows had run an update. A few hours later, I saw that my computer had no trace of my program. I realize this is an old post, but I thought I would shed some light on what I did, since i was able to recover my files.
First I went here: http://windows.microsoft.com/en-us/windows7/recover-lost-or-deleted-files
In Visual Basic 2010 Express, a backup folder is created with your project name. Sure enough, my project backckup folder was there: Documents\Visual Studio 2010\Backup Files\MyProject. But, the folder was empty. I "restored this folder to a previous version" using the steps listed in the link above. After doing that, the folder was still empty, BUT, the temporary folder "C:\Users{Username}\AppData\Local\Temporary Projects" now contained my project's folder and files. Prior to running the "restore to previous version", the temporary projects folder was also empty.
So, I was able to copy the folder out of the Temporary Projects folder and I am as happy as one can be - or close to it.
Hope that helps someone out.
A note to the answers above, I had a mini jumpscare when i could not find my project anywhere, not in the recent projects nor in the visual studio projects folder.
I eventually found the project in the visual studio projects folder of the admin user;
I was looking at:
C:\Users\LocalUser\Documents\Visual Studio 2015\Projects
Whilst the project was saved under:
C:\Users\LocalAdmin\Documents\Visual Studio 2015\Projects
Bottom line is; also check the \documents of the admin user. This likely happend because i was testing an admin only application and visual studio was running with the admin's user profile loaded.

Resources