visual-studio Subversion 应该忽略哪些 Visual Studio 文件以最大程度地减少冲突?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/588077/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 10:12:33  来源:igfitidea点击:

What Visual Studio files should be ignored by subversion to minimize conflicts?

visual-studiosvnversion-controltortoisesvnignorelist

提问by cdeszaq

I am supporting a number of .Net developers who are using Subversion to version control their work, but we have been running into a number of issues that seem to revolve around the additional files that Visual Studio uses to manage projects, do debugging, etc. Specifically, it seems that these files are causing conflicts due to the fact that they are already in the repo. I know how to get them out and how to handle them, but I need to know what "they" are first.

我支持许多使用 Subversion 对其工作进行版本控制的 .Net 开发人员,但我们遇到了许多问题,这些问题似乎与 Visual Studio 用于管理项目、进行调试等的附加文件有关。具体来说,这些文件似乎由于它们已经在 repo 中而导致冲突。我知道如何将它们弄出来以及如何处理它们,但我首先需要知道“它们”是什么。

So, what are the files/directories that Subversion can ignore, and why can they be ignored?(aka. what do those files do?)

那么,Subversion 可以忽略哪些文件/目录,为什么可以忽略它们?(又名。这些文件有什么作用?)

This is a large, rather un-organized ASP.Net site and deploying the site is done via. svn updates, so files needed by IIS to dynamically compile (I think that's what it is) the site as files change needs to be left in the repo.

这是一个大型的,相当无组织的 ASP.Net 站点,部署该站点是通过它完成的。svn 更新,因此 IIS 需要在文件更改时动态编译(我认为就是这样)站点所需的文件需要保留在 repo 中。

回答by Shawn Miller

  • bin and obj directories
  • *.user files (MyProject.csproj.user)
  • *.suo files
  • bin 和 obj 目录
  • *.user 文件 (MyProject.csproj.user)
  • *.suo 文件

Also, if you are using Visual Studio 2015 the .vs directory.

此外,如果您使用的是 Visual Studio 2015,则 .vs 目录。

回答by Jamison

I have had good luck with this global ignore pattern:

我对这种全局忽略模式很幸运:

*bin *obj *suo *.user *.tmp *.TMP 
*resharper* *Resharper* *ReSharper* *.Load *.gpState 
Thumbs.db *.~m2

I am running the Resharper plugin, so you can probably ignore that. ".~m2" is for a temporary file my data modeler creates.

我正在运行 Resharper 插件,因此您可以忽略它。“.~m2”用于我的数据建模者创建的临时文件。

Update: Thanks for the up-vote. I've recently added Mac, Dreamweaver, Python, and a few more Visual Studio files that should be ignored.

更新:感谢您的投票。我最近添加了 Mac、Dreamweaver、Python 和其他一些应该忽略的 Visual Studio 文件。

*.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp
*[Bb]in *obj *suo *resharp* *.user *.tmp *.TMP *Resharper*
*ReSharper* *.Load *.gpState *.NoLoad  *.~m2 *.dbmdl _notes *.cache
[Tt]est[Rr]esult [Bb]uild[Ll]og.* *.[Pp]ublish.xml *.[Cc]ache [Tt]humbs.db lint.db
*.docstates .apdisk [Ll]ogs .DS_Store *.bak *.vs

Something else, if someone accidentally checks in a folder or file that should be ignored, then you will need to manually remove the files from the repository before SVN will start ignoring them again. This is because files that are already in the repo will override any ignore settings.

另外,如果有人不小心签入了应该被忽略的文件夹或文件,那么您将需要手动从存储库中删除这些文件,然后 SVN 将再次开始忽略它们。这是因为存储库中已有的文件将覆盖任何忽略设置。

回答by Nielsvh

Old thread, but I want to add that you could use the gitignore example from GitHub, found here, for a good starting point.

旧线程,但我想补充一点,您可以使用 GitHub 中的 gitignore 示例,在此处找到,作为一个很好的起点。

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
*.vcxproj.filters

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# DNX
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# Visual Studio code coverage results
*.coverage
*.coveragexml

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush
.cr/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

# Cake - Uncomment if you are using it
# tools/

回答by JaredPar

  • *.bin
  • *.obj
  • *.exe
  • *.dll
  • *.pch
  • *.user
  • *.suo
  • *.tlb
  • TestResults (VSTS unit test directory)
  • *.bin
  • *.obj
  • *。可执行程序
  • *.dll
  • *.pch
  • *。用户
  • *.suo
  • *.tlb
  • TestResults(VSTS 单元测试目录)

回答by Bert Huijben

I think a better question would be "What files should I add to Subversion?"

我认为更好的问题是我应该将哪些文件添加到 Subversion?

The AnkhSVN 2.0 Subversion integration asks exactly this question to all the projects in your solution. (This question is one of the key parts of the SCC specification.) It will then only suggest adding these files.

AnkhSVN 2.0 Subversion 集成向您的解决方案中的所有项目提出了这个问题。(这个问题是 SCC 规范的关键部分之一。)然后它只会建议添加这些文件。

As user you can add other files manually (or mark some of the files suggested as ignored), but this behavior makes it very easy to do the right thing.

作为用户,您可以手动添加其他文件(或将一些建议的文件标记为忽略),但这种行为使得做正确的事情变得非常容易。

Most other subversion clients don't have the luxury of talking to a system that really understands what should and shouldn't be added. (E.g. External clients like TortoiseSVN and its frontends can just guess based on file extensions).

大多数其他 Subversion 客户端无法与真正了解应该添加什么和不应该添加什么的系统交谈。(例如,像 TortoiseSVN 这样的外部客户端及其前端可以根据文件扩展名进行猜测)。

回答by Hamish Smith

  • 'bin' directory is a good start (as @Kevin says).
  • You would do well to ignore the 'obj' directory too.
  • *.suo and *.user would be best left out of source control.
  • *.VisualState.xml is going to be personal choice too.
  • TestResults.xml (if you're using NUnit)
  • 'bin' 目录是一个好的开始(正如@Kevin 所说)。
  • 您也可以忽略 'obj' 目录。
  • *.suo 和 *.user 最好被排除在源代码控制之外。
  • *.VisualState.xml 也将是个人选择。
  • TestResults.xml(如果您使用的是 NUnit)

回答by Jimmy McNulty

Here's my TortoiseSVN global ignore:

这是我的 TortoiseSVN 全局忽略:

*.suo *.resharper *.sln bin obj *.user *.suo Debug Release *.pdb test.* _ReSharper*.* *.scc *.vssscc *.vspscc

The last 3 help when you transition from Microsoft Visual SourceSafe.

从 Microsoft Visual SourceSafe 过渡时的最后 3 个帮助。

回答by scwagner

AnkhSVNdoes a great job of only checking in the files that are necessary to the project.

AnkhSVN在只签入项目所需的文件方面做得很好。

回答by mezoid

In addition to the ones people have suggested above, I frequently have to ignore *.cachebecause for some reason I don't know Resharper likes to put it's .cache files in the same folders as the code I work on. Also, I don't think anyone has mentioned *.pdb yet.

除了上面人们建议的那些之外,我经常不得不忽略*.cache,因为出于某种原因,我不知道 Resharper 喜欢将它的 .cache 文件放在与我处理的代码相同的文件夹中。另外,我认为还没有人提到 *.pdb。

回答by Chris Bennet

I would also not check in the .SDF file. It's large and Visual Studio will recreate it if it is missing. It is a database used for Intellisense as far as I know.

我也不会签入 .SDF 文件。它很大,如果它丢失,Visual Studio 将重新创建它。据我所知,它是用于 Intellisense 的数据库。