为了减少冲突,颠覆应该忽略哪些 VisualStudio 文件?

我支持一些。使用 Subversion 进行版本控制的 Net 开发人员的工作,但是我们遇到了一些问题,这些问题似乎与 Visual Studio 用于管理项目、进行调试等的附加文件有关。具体来说,这些文件似乎正在引起冲突,因为它们已经在回购中。我知道怎么把他们弄出来,怎么处理他们,但我得先知道“他们”是什么。

那么,Subversion 可以忽略哪些文件/目录,为什么它们可以被忽略? (也就是说,这些文件是做什么的?)

这是一个很大的,相当无组织的 ASP.Net 站点,部署站点是通过。Svn 更新,所以 IIS 需要动态编译(我认为就是这样)站点所需的文件更改需要留在回购中。

45277 次浏览

我可能会说在 bin 目录中的任何东西。

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

  • Bin 和 obj 目录
  • * . user files (MyProject.csproj.user)
  • * . suo files

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

  • “ bin”目录是一个很好的开始(如 @ Kevin 说)。
  • 您最好也忽略‘ obj’目录。
  • * . suo 和 * . user 最好不要进行源代码控制。
  • * . VisualState.xml 也将是个人选择。
  • TestResults.xml (如果使用 NUnit)
  • * . bin
  • * . obj
  • * . exe
  • *
  • * . pch
  • * . user
  • *
  • * . tlb
  • TestResults (VSTS 单元测试目录)

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

在这种全球忽视模式上,我运气不错:

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

我正在运行 Resharper 插件,所以你可以忽略它。”.~ m2”是我的数据建模器创建的临时文件。

更新: 谢谢你的支持。我最近添加了 Mac、 Dreamweaver、 Python 和一些应该忽略的 VisualStudio 文件。

*.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

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

我想更好的问题应该是 “ < B > 我应该添加什么文件到 Subversion? ”

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

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

大多数其他的颠覆客户端都没有机会与一个真正理解什么应该添加什么不应该添加的系统进行对话。(例如,像 TortoiseSVN 这样的外部客户端和它的前端可以根据文件扩展名猜测)。

下面是我的 TortoiseSVN 全球忽略:

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

当你从 Visual SourceSafe 转变过来的时候。

我也不会在。SDF 文件。它很大,如果缺少它,VisualStudio 将重新创建它。据我所知,这是一个用于智能感知的数据库。

旧线程,但我想补充的是,您可以使用来自 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/