.NET是什么文件应该被排除在源代码控制?源代码、文件、NET

2023-09-03 08:51:39 作者:愿君安好

应该被排除在.NET应用程序是什么文件扩展名,从源头控制,为什么好吗?

What file extensions from a .net application should be excluded from source control and why please?

推荐答案

取决于项目,但我已经得到了以下在我的.gitignore一个Silverlight + WPF项目:

Depends on the project, but I've got the following for a Silverlight + WPF project in my .gitignore:

# Visual Studio left-overs
*.suo        # 'user' settings like 'which file is open in Visual Studio'
*.ncb        # Used for debugging
*.user
*.ccscc      # Used for versioning
*.cache

# Editor left-overs
*~           # (x)emacs
*.bak        # Windows related
\#*\#        # (x)emacs
*.orig       # Own usage

# Compiled files
*/bin/
*/obj/
*/Obj/       # git is case sensitive
*/Generated_Code/
PrecompiledWeb
*/ClientBin
# Windows left-overs
Thumbs.db    # Having images in the source tree generates those files in Explorer

不过,名为.suo是有点问题:它也包含用户设置,这应该是项目设置,像Silverlight应用程序的启动页

However, the '.suo' is somewhat problematic: it also contains 'user' settings which should have been project settings, like the startup page for a Silverlight application.

最好的和唯一的办法就是反复添加要排除的文件。如果你使用Git,使用Git GUI快速,交互地看到你已经忘记了排除的文件列表。适应的.gitignore和刷新混帐贵。迭代,直到文件遗留在您键入的人。

The best and only way is to iteratively add the files to exclude. If you're using git, using git-gui to quickly and interactively see the list of files which you've forgotten to exclude. Adapt .gitignore and refresh in git-gui. Iterate until the files left over are the ones you typed in.

某些类型的文件还不太清楚前面。要确保你了解所有你检查的文件。例如,对于RIA服务在我们的Silverlight项目,我们不得不用含有2个帐户,并造成了巨额的10Mb的.mdb数据库文件的Visual Studio生成验证数据库(​​!)。一旦我们理解它来自何处,它更改为SQL转储减少了尺寸为(仍然沉重)500KB。不断(重新)之前签自身检查是必需的,所以没有清单是肯定的。

Some types of files are not quite clear up front. Be sure you understand all the files you check in. For example, for the RIA services in our Silverlight project we had an authentication database generated by Visual Studio which contained 2 accounts and resulted in a hefty 10Mb .MDB database file(!). Once we understood where it came from, changing it to an SQL dump reduced the size to a (still hefty) 500Kb. Constantly (re)checking prior to the checkin itself is always required, so no list is definite.