Is there a way to revert a Visual Studio Project to the previous build

John Glynn 106 Reputation points
2022-04-26T20:29:14.47+00:00

So I am Quite frustrated because my Visual Studio Project wasn't updating the code so I decided to rebuild it and now all the files are gone from the debug folder and the project is pretty much impossible to use. Is there a way to recover it? I have spent 2 years working on this Project without any issues but now it just happened and Im pissed please help.

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,605 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,131 questions
{count} vote

Accepted answer
  1. Michael Taylor 49,246 Reputation points
    2022-04-26T20:50:36.577+00:00

    The Debug folder is where your build output goes. If you are making code changes and compiling/running your app then the directory will have all the binaries you need to run the app. If nothing is there then either you are building to a different directory or there is a compiler error. Once you fix the compiler error your binaries will show back up.

    But if you are also generating content files into that directory (such as when your app runs) then those files aren't guaranteed to be kept around anyway. The output directory can get wiped during any build of your app but normally this only happens if you do a clean or rebuild. In this case those directories are emptied out first. They aren't for storing stuff that isn't part of your build process. Content files that need to be there should be in your project directory somewhere (often in a Content folder) and copied to the output as part of the build process. Any content generated at runtime is gone. You might be able to get it back from the recycling bin but otherwise you'd need to rebuild it. If you need data to persist across clean builds then you need to store the data outside the build directory.

    As for source code, you are hopefully using a source control system like Git/Github/subversion so your source code is safe. This is important for many reasons, not just because of the output directory (where your source files shouldn't be sitting anyway). If you don't yet have your code in source control then you need to get it there as soon as possible so you have a permanent backup.


0 additional answers

Sort by: Most helpful