从磁盘删除不在 Visual Studio 项目中的文件
任何人都可以想到一种方法(可能使用 PowerShell 脚本或类似脚本),让我可以在文件夹结构中查找磁盘上但不包含在项目文件中的 *.cs 文件吗?
随着时间的推移,随着 Subversion 等的合并,这种情况逐渐发生。基本上,我正在寻找一种自我清理的方法。 :)
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. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的所有 .cs 文件都会在项目文件中提及,对吧? 抓取 XML,列出文件,然后对整个系统进行搜索。 有效,但效率低下。
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.
解决方案资源管理器顶部的“显示所有文件”按钮,然后手动检查?
"Show all files" button at the top of Solution Explorer, then manually inspect?
我的另一篇文章中的 PowerShell 脚本将执行此操作。 该脚本将从项目文件中获取包含文件的列表,并将其与磁盘上的文件进行比较。 您将获得磁盘上但未包含在项目中的一组文件。 您可以删除它们,也可以将它们作为删除挂起在 TFS 中。
脚本位于:https://stackoverflow.com/a/23420956/846428
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