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

11

74

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.

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

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.

Cusk answered 25/2, 2009 at 21:53 Comment(5)
If you used a VS plug-in to integrated VS with SVN then VS itself would only add the files it needed to SVN. As such it would filter out the files that don't need to be version controlled.Justice
@Justice - I've found that the VS-integrated SVN clients are significantly sub-par when compared to the standalone SVN clients, which is why I asked the question :)Cusk
I'm not sure which plug-ins you've tried, but as the author of one such VS plug-in (which is MS-SCCI based) I find it can make working with SVN much easy. Why? Because the IDE controls what files get put into the repo. Also adding, removing or moving files can all be done from inside the IDE. Finally the IDE gives visual feedback as to the status of the files (i.e. file not added, file out of date etc).Justice
PS: Having said all of that, my experience is limited to VS C# WinFroms projects and VS ASP.Net projects might be a different kettle of fish ;)Justice
I agree that the additions a VC solution can provide to an IDE are quite nice, but I've never found an IDE VC plugin that does as good a job as a dedicated VC client, at least in terms of managing the versions. (Mostly because most IDEs VC models are too general). Also, to be fair, I've moved away from SVN to Mercurial (and now Git) because SVN simply couldn't handle the needs I and my teams have regarding workflow.Cusk
F
85
  • bin and obj directories
  • *.user files (MyProject.csproj.user)
  • *.suo files

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

Fa answered 25/2, 2009 at 21:57 Comment(1)
@plntxt I'm assuming that currently the packages folder should be part of this list, unless there is some nuance I'm not taking into account.Berns
S
49

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.

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

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

Symmetrical answered 25/2, 2009 at 22:28 Comment(3)
it looks like *.gpState is added twice.Parietal
In my opinion global ignores are not the way to go. What happens with this is that the next person to check out your project will see a bunch of files that look unversioned and they may accidentally commit them. Using the svn-ignore property is better because then anyone using the project in the future can't make a mistake because their ignores are already set up.Lillylillywhite
A quick update for anyone digging through these comments - as of SVN 1.8 (released in 2013) they added the svn:global-ignores property which is part of the repository, and it is different from the local global ignores that I believe @Lillylillywhite is referring to. You can read more here SVN 1.8 release notes and also here Advanced IgnoringRoentgenology
A
9

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

## 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/
Attalanta answered 8/11, 2016 at 21:19 Comment(0)
M
7
  • *.bin
  • *.obj
  • *.exe
  • *.dll
  • *.pch
  • *.user
  • *.suo
  • *.tlb
  • TestResults (VSTS unit test directory)
Malchus answered 25/2, 2009 at 22:6 Comment(0)
O
6
  • '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)
Overarm answered 25/2, 2009 at 21:59 Comment(0)
H
6

I think a better question would be "What files should I add to 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.

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

Highbrow answered 25/2, 2009 at 23:56 Comment(2)
So then, is there a way to determine this from outside of Visual Studio? Ankh doesn't meet all of our needs, and for some reason doesn't play nicely with how we structure things, so we can't rely on it to do this.Cusk
The only way to talk to VS projects as an SCC provider is 'as an SCC provider'.. and that can only be done from inside VS.. If you have specific usecases that aren't handled by AnkhSVN you should tell us on the ankhsvn user list (or uservoice page).. otherwise there is not much we can fix:)Highbrow
T
4

Here's my TortoiseSVN global ignore:

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

Taproot answered 26/2, 2009 at 0:5 Comment(0)
S
3

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

Sightless answered 25/2, 2009 at 21:57 Comment(2)
Do they have a list anywhere?Cusk
AnkhSVN 2.0 doesn't use a list of what to ignore. The project provides a list of what should be added to its SCC Provider, in this case AnkhSVN. And AnkhSVN only suggests adding these files. (A user can override these settings; but normally you shouldn't)Highbrow
P
2

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.

Pacha answered 18/12, 2015 at 14:33 Comment(0)
I
1

I would probably say anything in the bin directory.

Inapproachable answered 25/2, 2009 at 21:54 Comment(0)
S
1

In addition to the ones people have suggested above, I frequently have to ignore *.cache because 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.

Sequestered answered 25/2, 2009 at 22:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.