AutoRecover retention policy and cleanup timing in Visual Studio 2022
0 reputation · 31 Jan 2024, 02:50 UTC
AutoRecover retention policy and cleanup timing in Visual Studio 2022
The goal is to understand and configure how long AutoRecover files are kept and when they are purged, so that recovery data can be reliably integrated into a backup and verification workflow.
AutoRecover is enabled by default and stores snapshots every 5 minutes, with a 7‑day retention period. The snapshots are written to a machine‑specific directory (%LOCALAPPDATA%\Microsoft\VisualStudio\\AutoRecover) and are not part of the VCS or server‑side backup. The exact trigger for cleanup—whether it occurs on startup, shutdown, or via a background job—is not clearly documented, and there is no exposed API to adjust the retention period beyond the UI setting.
Because the AutoRecover directory is local, restoring a solution on a different machine or after a profile reset may leave the IDE unable to recover unsaved work, creating a gap in the backup strategy. Verification of recovered data currently requires manual diffing against the last committed state.
Key questions
- When does Visual Studio purge AutoRecover files that exceed the configured retention period?
- Is there a way to extend or reduce the retention period programmatically, or to trigger cleanup on demand?
- Can the IDE be configured to automatically verify that recovered files match the last committed state in source control?