REW

How Do I Recover A Deleted Project In Visual Studio?

Published Aug 29, 2025 4 min read
On this page

If you have deleted a project in Visual Studio, your best chance of recovery depends on several factors: whether you used a version control system like Git, if the files are still in your Recycle Bin, or if you can find temporary backup files.

A strong version control habit is the most reliable way to prevent this scenario.

Method 1: Restore from version control (Git or TFVC)

If your project was managed with a version control system, this is the most robust and recommended recovery method.

With Git

If you deleted a project that was still on an uncommitted local branch, you can simply revert the changes.

  • Use the Git Changes window. In Visual Studio, navigate to View > Git Changes. Find the deletion in the list of changes, right-click it, and select Undo.

  • Use the command line. Open a terminal and navigate to your project's root directory. Run the following command:sh

    git checkout -- .
    

    Use code with caution.

    This will restore all files in the current directory to their last committed state.

If you have already committed the deletion, you can either revert the commit or roll back to a previous one.

  • Revert the commit. To create a new commit that undoes the deletion, find the commit in the Git History and use the Revert option.
  • Reset the branch. If you want to completely erase the commit history since your last known good state, you can use a hard reset. Navigate to the Git History, right-click the last valid commit, and select Reset > Delete Changes (--hard). This is a destructive operation that will permanently remove any subsequent, unpushed changes.

With Team Foundation Version Control (TFVC)

If you're using TFVC with Azure Repos, you have different options depending on when the project was deleted.

  • Undo pending changes. If you deleted the project but have not yet checked in the changes, go to the Pending Changes page in Team Explorer. Find the deleted items under Included Changes, right-click them, and choose Undo.
  • Undelete from the server. If you have already checked in the deletion, you must undelete the files from the server.
    1. Go to Tools > Options > Source Control > Visual Studio Team Foundation Server.
    2. Check the box for "Show deleted items in the Source Control Explorer" and click OK.
    3. In the Source Control Explorer, find your deleted project (it will have a red "X").
    4. Right-click the project folder and select Undelete.

Method 2: Restore from the Recycle Bin

When you delete a project folder from the Visual Studio Solution Explorer, the files are typically sent to the operating system's Recycle Bin. This is the simplest method if you haven't permanently deleted them.

  1. Navigate to your desktop and double-click the Recycle Bin icon.
  2. Search for your project folder by name.
  3. Right-click the folder and choose Restore.
  4. The project folder will be returned to its original location.
  5. If you have trouble finding it, manually search the original directory where the project was saved.

Method 3: Recover using Visual Studio's AutoRecover feature

Visual Studio has a built-in feature that can save backup files in case of a crash or accidental closure.

  1. Navigate to the Visual Studio backups folder. You can find it by entering the following path in File Explorer:sh

    %LocalAppData%\Microsoft\VisualStudio\BackupFiles
    

    Use code with caution.

  2. Look for a subfolder with your project name.

  3. If you find files, copy them back into your main project folder.

  4. In Visual Studio, right-click your solution in the Solution Explorer and select Add > Existing Item to manually re-add any recovered files.

Method 4: Use third-party data recovery software

If the Recycle Bin has been emptied and you were not using version control, your only option is to use a data recovery tool. These programs scan your hard drive for file data that has not yet been overwritten.

  1. Stop using your computer immediately. To avoid overwriting the data, do not install new programs or save new files.
  2. Download and install a data recovery tool like Recuva or EaseUS Data Recovery Wizard on a different computer or a separate storage device.
  3. Run the software and perform a deep scan of the drive where your project was saved.
  4. The tool will present a list of recoverable files. Look for your project files, which will likely have their original names and extensions (e.g., *.cs, *.vb, *.csproj, *.sln).
  5. Recover the files to a different drive to avoid further data loss.

Method 5: Look for cloud backups

If you were syncing your project folder with a cloud storage service like OneDrive, Dropbox, or Google Drive, you can check its version history or trash folder.

  1. Log in to your cloud service's web interface.
  2. Navigate to the folder where your project was saved.
  3. Look for a "Trash," "Deleted Files," or "Version History" option.
  4. Find your deleted project and restore it from there.

A note on Visual Studio Code

For users of Visual Studio Code, there is a helpful "Local History" feature that is automatically enabled. You can recover individual deleted files by opening the Command Palette (Ctrl+Shift+P), typing "Local History: Find Entry to Restore", and selecting the file from the list.

Enjoyed this article? Share it with a friend.