问题
Can anyone think of a way (perhaps using a PowerShell script or similar) where I can look for *.cs files that are on disk in the folder structure, but aren't included in a project file?
This has come about gradually over time with merging in Subversion etc. I'm looking for a way to clean up after myself, basically. :)
回答1:
All your .cs files will be mentioned in the project file, right? Scrape the XML, list the files and then do a search on the whole system. Works, but is inefficient.
回答2:
"Show all files" button at the top of Solution Explorer, then manually inspect?
回答3:
The PowerShell script in my other post will do this. The script will get the list of included files from the project file and compare that against the files on disk. You will get the set of files that are on disk but not included in the project. You can either delete them or pend them as deletes in TFS.
The script is here: https://stackoverflow.com/a/23420956/846428
来源:https://stackoverflow.com/questions/561043/delete-files-from-disk-that-arent-in-a-visual-studio-project