Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

visual studio 2010 - Remove unused source code files

In Visual Studio 2010 I have a large solution that contains number of .cs files that are no longer used (not referenced in .csproj), but still present in code repository (ClearCase). Do you know of any tool / extension / script that would find all such files?

One could write a script that goes through all projects' directories, takes all files that are checked in and than compares against content of a project file. In it is not there, than we have a candidate for deletion. It is not too exotic, so I wonder whether such a script already exist. Otherwise it will be a good occasion to get dust off my Python book.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The only script already discussed on SO was "Visual Studio macro: Find files that aren't included in the project?".

It could be completed with a cleartool command in order to :

Since it is a bit cumbersome, another approach would be to:

  • run the script and delete the unused files (simple OS delete, nothing to do with ClearCase)
  • import the result back into ClearCase (with clearfsimport), using a -rmname option: that will automatically delete the target files which are no longer present in the imported source (ie the one where you executed your cleaning script).

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...