C# 消除visual studio解决方案文件夹中的临时文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12428140/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eliminate temporary files in visual studio solution folder
提问by Stein ?smul
I am cleaning up a bunch of visual studio projects / solutions from different sources, and there are an incredible amount of temporary filesand temporary foldersstored in each solution.
我正在清理来自不同来源的一堆 Visual Studio 项目/解决方案,每个解决方案中都存储了大量的临时文件和临时文件夹。
I am wondering what file types are safe to delete so that I can write a script to take care of the heavy lifting so there is less junk to push around when I am trying to get the whole folder structure organized and linked up to the proper shared file locations.
我想知道哪些文件类型可以安全删除,以便我可以编写脚本来处理繁重的工作,这样当我尝试组织整个文件夹结构并将其链接到正确的共享文件时,可以减少垃圾文件位置。
As far as I can see the following files and folders are temporary and can be safely deleted:
据我所知,以下文件和文件夹是临时的,可以安全删除:
Files
文件
- *.sdf
- *.sln.docstates
- *.suo
- *.upgradelogxml
- *.user
- *.vcxproj.filters
- *.sln.old
- *.suo.old
- UpgradeLog.XML
- *.wixproj.vspscc
- *.csproj.vspscc
- *.SCC
- *.ncb
- *.opt
- *.plg
- *.aps
- *.clw
- *.sdf
- *.sln.docstates
- *.suo
- *.upgradelogxml
- *。用户
- *.vcxproj.filters
- *.sln.old
- *.suo.old
- 升级日志文件
- *.wixproj.vspscc
- *.csproj.vspscc
- *.SCC
- *.ncb
- *。选择
- *.plg
- *.aps
- *.clw
Folders
文件夹
- _UpgradeReport_Files (folder)
- ipch (folder)
- bin, obj, debug, release and other build output folders though there could be files copied into here during build...
- Backup, Backup1, etc...
- _UpgradeReport_Files(文件夹)
- ipch(文件夹)
- bin、obj、debug、release 和其他构建输出文件夹,尽管在构建过程中可能会将文件复制到此处...
- 备份、备份 1 等...
I am not even sure what some of these file types really are, I just know they are re-generated when you open the solution - and I know there are many more file types that I have missed from older and newer versions of Visual Studio.
我什至不确定其中一些文件类型到底是什么,我只知道当您打开解决方案时它们会重新生成 - 而且我知道我在旧版和新版 Visual Studio 中遗漏了更多文件类型。
Are there any file types that should be preserved in the list above? If so, for what reason, and are there further file types that can be cleaned out without any serious side effects?
上面的列表中是否应该保留任何文件类型?如果是这样,出于什么原因,是否还有其他文件类型可以清除而不会产生任何严重的副作用?
The overall idea is to minimize the size and complexity of the solution when it is to be migrated, moved or reorganized or otherwise shuffled around enough for this "solution fat" to be a serious performance and management problem.
总体思路是在迁移、移动或重组或以其他方式调整解决方案时,尽量减少解决方案的大小和复杂性,这些“解决方案脂肪”足以成为严重的性能和管理问题。
Typically I see this problem if I need to check something into a new source control system, zip and send sample code by email or put third party or peer code into an existing hierarchy of shared folders and files.
通常,如果我需要将某些内容签入新的源代码控制系统、压缩并通过电子邮件发送示例代码或将第三方或对等代码放入共享文件夹和文件的现有层次结构中,我就会看到这个问题。
采纳答案by Dai
I disagree with your list of "temporary" files - certainly very few of them are temporary in nature (otherwise they'd be in the %TEMP% directory). Granted, most of them are not necessary for your project to build successfully, but they are still important.
我不同意你的“临时”文件列表——当然,它们中很少有本质上是临时的(否则它们会在 %TEMP% 目录中)。诚然,它们中的大多数对于您的项目成功构建并不是必需的,但它们仍然很重要。
- sdf - SQL Server Compact database. Used by VS2012 to store VC intellisense data. Without this file you will not get intellisense and code-completion until it rebuilds.
- sln.docstates - Stores temporary state information about files in your solution.
- suo - Contains information about your per-solution IDE customization settings, such as window layout and toolbox loadout. It's generally safe to delete this but your solution might take longer to load in future and you'll lose any UI customizations.
- upgradelog.xml - Yeah, the upgrade-log files are a bit of a mess. This can be deleted.
- user - I'm sure this is an old file from VC6 days...
- vcxproj.filters - Keep this, it's a per-computer/per-project filesystem organisation list thingie
- sln.old - "old" files are not VS files. This looks like a backup file made by a user or tool.
- suo.old -
- UpgradeLog.XML - this can be deleted if you're not using the UpgradeLog tool
- wixproj.vspscc - never delete this file if you're using source control. It's part of VS's source control integration. It's hell trying to re-integrate unchecked changes back into source-control after deleting binding files. Only delete this if you're not using source control.
- csproj.vspscc - same as above.
- SCC - Used for source control. Never delete this if you're using source control.
- ncb - Intellisense cache used in VC6 through 2010. If you delete this you'll lose VC intellisense until the IDE has rebuilt it, which can take aaaggess on large projects.
- sdf - SQL Server Compact 数据库。VS2012 用于存储 VC 智能感知数据。如果没有这个文件,你将无法获得智能感知和代码完成,直到它重建。
- sln.docstates - 存储有关解决方案中文件的临时状态信息。
- suo - 包含有关每个解决方案 IDE 自定义设置的信息,例如窗口布局和工具箱加载。删除它通常是安全的,但您的解决方案将来可能需要更长的时间来加载,并且您将丢失任何 UI 自定义。
- upgradelog.xml - 是的,升级日志文件有点乱。这个可以删除。
- 用户 - 我确定这是 VC6 天的旧文件...
- vcxproj.filters - 保留这个,它是每台计算机/每项目文件系统组织列表的东西
- sln.old - “旧”文件不是 VS 文件。这看起来像是由用户或工具制作的备份文件。
- suo.old -
- UpgradeLog.XML - 如果您不使用 UpgradeLog 工具,可以将其删除
- wixproj.vspscc - 如果您使用源代码管理,请不要删除此文件。它是 VS 源代码控制集成的一部分。在删除绑定文件后,试图将未经检查的更改重新集成到源代码管理中是很糟糕的。仅当您不使用源代码管理时才删除它。
- csproj.vspscc - 同上。
- SCC - 用于源代码控制。如果您使用的是源代码管理,请不要删除它。
- ncb - 到 2010 年在 VC6 中使用的 Intellisense 缓存。如果删除它,您将丢失 VC 智能感知,直到 IDE 重建它,这可能会对大型项目造成影响。
I've no idea what this or the other files are: .opt, .plg, .aps, .clw
我不知道这个文件或其他文件是什么:.opt、.plg、.aps、.clw
Of course, the trick is to properly arrange your files in your solution in the first place. Project source files should be kept separate from project metadata (i.e. the files I just listed above), ideally in separate folders in their own heirarchy (that way you can have multiple VC project files for the same source code, allowing contributors to use VC2005, 2008, and 2010 at the same time).
当然,诀窍是首先在解决方案中正确排列文件。项目源文件应与项目元数据(即我刚刚在上面列出的文件)分开保存,最好在它们自己的层次结构中的单独文件夹中(这样您可以为同一源代码拥有多个 VC 项目文件,从而允许贡献者使用 VC2005, 2008 年和 2010 年同时)。
回答by Mark Heath
Have a look at the folders and extensions listed in the answers to this Visual Studio .gitignore questionfor an idea of the files that are commonly considered non-essential.
查看此 Visual Studio .gitignore 问题的答案中列出的文件夹和扩展名,以了解通常被视为非必要的文件。
However, it is generally speaking not a good idea to delete stuff if you don't know what it is. For example, .sdf files may be SQL Server CE databases, which might be important in some projects. So make sure you make a backup somewhere before running any solution cleaner scripts.
但是,一般来说,如果您不知道它是什么,则删除它并不是一个好主意。例如,.sdf 文件可能是 SQL Server CE 数据库,这在某些项目中可能很重要。因此,请确保在运行任何解决方案清理脚本之前在某处进行备份。

