Renaming Files with VS.NET and VSS

posted on 2005-03-28 at 23:53:04 by Joel Ross

As part of getting ready for deployment, I cleaned up our sourcesafe database, removing files that were at one point part of our project but no longer are. This allows our automated build process to pick up just the files that should be there. We use Nant and the solution task, so we don't get files compiled in that shouldn't be there, but we do get extra files in our directory, so it was time to do some clean up work.

Anyway, as I was removing files, I noticed a lot of the files that got removed weren't really removed. They were renamed in VS.NET, which causes an extra file to be added to VSS. Seeing this, I was reminded of the correct way to rename files when using VS.NET and VSS, so here it is:

  1. Exclude the file to be renamed from the project. You'll have to check out the project to do this.
  2. Rename the file in VSS.
  3. Get the latest of the renamed file, and add that file to your project.
  4. Check in the project file.

Doing this prevents erroneous files in VSS, and it preserves the file history. Both very good things!

Remember though, that when you do delete a file from VSS, don't destroy it permanently. That way, it's there if you need it, but not there if you don't.

Categories: Development