Visual Studio .gitignore Template
The full, current Visual Studio .gitignore template — copy it as-is, or head to the .gitignore Generator to merge it with other stacks into one file.
Template
# User-specific files *.suo *.user *.userosscache *.sln.docstates # Build results [Dd]ebug/ [Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ x64/ x86/ [Ww][Ii][Nn]32/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ bld/ [Bb]in/ [Oo]bj/ [Ll]og/ [Ll]ogs/ # Visual Studio cache/options directory .vs/ # NuGet Packages *.nupkg **/[Pp]ackages/* !**/[Pp]ackages/build/ *.nuget.props *.nuget.targets # Visual Studio profiler *.psess *.vsp *.vspx *.sap # ReSharper is a .NET coding add-in _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user # JetBrains Rider .idea/ *.sln.iml
What each entry does
Why every line in this template is excluded, not just what it matches.
| Entry | Why it's excluded |
|---|---|
| *.suo | Visual Studio's binary per-user solution options file — machine-specific and often corrupts merges if tracked. |
| *.user | A per-user project options file (MSBuild/Visual Studio) — overrides you don't want forced onto teammates. |
| *.userosscache | Visual Studio's per-user, OS-specific options cache — machine-specific. |
| *.sln.docstates | Files matching *.sln.docstates — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| [Dd]ebug/ | A generated/local directory ([Dd]ebug) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| [Dd]ebugPublic/ | A generated/local directory ([Dd]ebugPublic) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| [Rr]elease/ | A generated/local directory ([Rr]elease) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| [Rr]eleases/ | A generated/local directory ([Rr]eleases) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| x64/ | A generated/local directory (x64) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| x86/ | A generated/local directory (x86) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| [Ww][Ii][Nn]32/ | A generated/local directory ([Ww][Ii][Nn]32) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| [Aa][Rr][Mm]/ | A generated/local directory ([Aa][Rr][Mm]) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| [Aa][Rr][Mm]64/ | A generated/local directory ([Aa][Rr][Mm]64) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| bld/ | A generated/local directory (bld) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| [Bb]in/ | Compiled build output. Regenerated by every build, so tracking it just creates merge conflicts on binary files. |
| [Oo]bj/ | .NET's intermediate build artifacts (MSBuild's working directory) — never meant to be shared, only regenerated. |
| [Ll]og/ | A generated/local directory ([Ll]og) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| [Ll]ogs/ | A directory of runtime log files — same reasoning as *.log: regenerated, machine-specific, unbounded. |
| .vs/ | Visual Studio's local solution cache (IntelliSense DB, window layout) — machine-specific and safely regenerated. |
| *.nupkg | A packed NuGet package file — build output of `dotnet pack`, not source. |
| **/[Pp]ackages/* | Excludes **/[Pp]ackages/* — generated or machine-specific for this stack, not something to track in version control. |
| !**/[Pp]ackages/build/ | Re-includes **/[Pp]ackages/build — carves out an exception to a broader exclusion pattern above it. |
| *.nuget.props | Files matching *.nuget.props — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| *.nuget.targets | Files matching *.nuget.targets — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| *.psess | Files matching *.psess — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| *.vsp | Files matching *.vsp — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| *.vspx | Files matching *.vspx — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| *.sap | Files matching *.sap — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| _ReSharper*/ | ReSharper's per-solution cache and settings — regenerated by the plugin, machine-specific. |
| *.[Rr]e[Ss]harper | Files matching *.[Rr]e[Ss]harper — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| *.DotSettings.user | A ReSharper per-user settings override — not meant to be shared with the team. |
| .idea/ | JetBrains IDEs' (IntelliJ, Rider, PyCharm, Android Studio, WebStorm...) per-project settings — mostly machine/user-specific. |
| *.sln.iml | Files matching *.sln.iml — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |