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

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)?

LVL 32
Daniel WilsonAsked:
Who is Participating?
qz8dswConnect With a Mentor Commented:
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)
Daniel WilsonAuthor Commented:
Thanks for the link & explanation.

No more development under Documents for me!  Not a lesson I'll forget quickly ...
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.