I'm getting married! - More Details

The power of MSBuild scripts

Tuesday, January 16, 2007 9:33 AM

My lack of posts over the past few days can be directly attributed to the fact that I had a bit of a mishap with my work computer...

Long story short, I basically deleted all of the files on my PC...

I was working on setting up some automated build & deployment scripts, and a mistake in my MSBuild script caused everything on my PC to be deleted.

I have no way of knowing for sure (because everything is deleted), but I think what happened was this...

I was wanting to delete all of the files in the destination directory for the build.

 

Then somewhere in my "Deploy" target, I would have done something like this..

Basically, delete all of the files in the $(DeploymentPath) directory. Perfectly acceptable, and worked fine in testing.

I think what happened though, is that I forgot to SET the $(DeploymentPath) variable! So in essence, it was saying:

Delete all the files below the \ (or c:\) directory...

You can imagine what happens next. Basically my computer went haywire, and of course wouldn't boot back up. When we took a look at the drive, everything was gone, except for anything that was read-only (VSS files), or in was use (system files). Luckily, I had checked in all of my code earlier that day, so it was all on the server somewhere.

Moral of the story:

Be extra careful when delete files with MSBuild scripts. Ensure that all of your variables have the correct values BEFORE deleting recursively :-)

Comments

Sara
keep your chin up! lol
Zink
That's rough. But... I bet you'll never make that mistake again.
Antoniak
Wow... That's a rough one. Good thing you keep the data on a different drive than the operating system... and you had a recent backup of the drive... right? Right?
Dusty
@Zink - dang right I won't do that again! I've since revamped all my scripts, taking special care to check for empty variables this time! It took me a while to get up the courage to even *run* the scripts though :-)

@Antoniak - Yeah, all my data luckily was on a network drive. I guess I'm just thankful that I didn't start recursively deleting some network drive.. eeeks! They had to rebuild my machine from scratch though, which took the better part of a week. Hopefully they took an image of it or something for the next time I do this :-)


Post a comment

   
 
  
  

    

All content © Dusty Davidson