.gitignore for Visual Studio Projects and Solutions
See the official GitHub's "Collection of useful .gitignore templates".
The .gitignore
for Visual Studio can be found here:
https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
There's an online tool which allow you to generate .gitignore file based on your OS, IDE, language, etc. Take a look at http://www.gitignore.io/.
On 8/20/2014, here's the file that is generated for Visual Studio + Windows.
# Created by http://www.gitignore.io### VisualStudio ##### Ignore Visual Studio temporary files, build results, and## files generated by popular Visual Studio add-ons.# User-specific files*.suo*.user*.sln.docstates# Build results[Dd]ebug/[Dd]ebugPublic/[Rr]elease/[Rr]eleases/x64/x86/build/bld/[Bb]in/[Oo]bj/# Roslyn cache directories*.ide/# MSTest test Results[Tt]est[Rr]esult*/[Bb]uild[Ll]og.*#NUNIT*.VisualState.xmlTestResult.xml# Build Results of an ATL Project[Dd]ebugPS/[Rr]eleasePS/dlldata.c*_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 filesipch/*.aps*.ncb*.opensdf*.sdf*.cachefile# Visual Studio profiler*.psess*.vsp*.vspx# 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 addin-in.JustCode# TeamCity is a build add-in_TeamCity*# DotCover is a Code Coverage Tool*.dotCover# NCrunch_NCrunch_*.*crunch*.local.xml# MightyMoose*.mm.*AutoTest.Net/# Web workbench (sass).sass-cache/# Installshield output folder[Ee]xpress/# DocProject is a documentation generator add-inDocProject/buildhelp/DocProject/Help/*.HxTDocProject/Help/*.HxCDocProject/Help/*.hhcDocProject/Help/*.hhkDocProject/Help/*.hhpDocProject/Help/Html2DocProject/Help/html# Click-Once directorypublish/# 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# 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/# If using the old MSBuild-Integrated Package Restore, uncomment this:#!**/packages/repositories.config# Windows Azure Build Outputcsx/*.build.csdef# Windows Store app package directoryAppPackages/# Otherssql/*.CacheClientBin/[Ss]tyle[Cc]op.*~$**~*.dbmdl*.dbproj.schemaview*.pfx*.publishsettingsnode_modules/# RIA/Silverlight projectsGenerated_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*.XMLUpgradeLog*.htm# SQL Server files*.mdf*.ldf# Business Intelligence projects*.rdl.data*.bim.layout*.bim_*.settings# Microsoft FakesFakesAssemblies/### Windows #### Windows image file cachesThumbs.dbehthumbs.db# Folder config fileDesktop.ini# Recycle Bin used on file shares$RECYCLE.BIN/# Windows Installer files*.cab*.msi*.msm*.msp
I use the following .gitignore for C# projects. Additional patterns are added as and when they are needed.
[Oo]bj[Bb]in*.user*.suo*.[Cc]ache*.bak*.ncb*.log *.DS_Store[Tt]humbs.db _ReSharper.**.resharperAnkh.NoLoad