System Restore deleted my C Sharp files! -- how to prevent this?

Posted on 2009-05-02
Last Modified: 2013-12-17
I installed a program on my Windows Vista Business system.  It locked the computer up.  So I booted into Safe Mode and ran a System Restore to the latest checkpoint ... 5 days ago.

Upon rebooting, I went to My Documents\Visual Studio 2005\Projects\MyProject ... and found that my C# files were gone.  2 days work -- gone.

Since I restored in Safe Mode, I understand that I can't undo the problem.  Those files are in the bit bucket.

Now -- how do I prevent this from happening again?  System Restore isn't supposed to affect documents, photos, etc. ... but evidently .cs files are considered fair game.

Is it b/c they were under My Documents (where VS throws stuff by default)?

Question by:Daniel Wilson
    LVL 15

    Accepted Solution

    Hi Daniel,

    As per
    The third response down by Bert Kinney.

    "File type (.cs) is monitored by System Restore. ...........
    And in Vista, the Documents folder is not exempt from System Restore as the
    My Documents folder was in XP."

    Also as per WTC's response in the same post.
    "You can tell System Protection (System Restore) not backup certain
    folders and files at this location in the Registry.

    [HKLM\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToBackup]" but I don't know if that works (however I do notice it takes a /s parameter which I'd assume to be sub directories)
    LVL 32

    Author Comment

    by:Daniel Wilson
    Thanks for the link & explanation.

    No more development under Documents for me!  Not a lesson I'll forget quickly ...
    LVL 15

    Expert Comment

    No worries,
    BUT from what I read in that post, system restore for vista will monitor all directories for extensions listed here (plus a couple of others).
    It's easy enough to test, make a c:\programming directory, copy one of your C# projects to that directory, create a restore point, change the project in some way and save it then go back to your restore point.

    I think you will find the .CS got rolled back to before your change.
    If thats the case you would need to (in my example)
    Add a string value to the [HKLM\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToBackup] registry key.

    Name it Programming, and the value would be c:\programming\*.* /s
    Then reboot so the system restore loads the new values. (I don't know if it's dynamic or not)
    From there I would test it again, but from what I've found that should do the trick.


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now