.gitignore Builder for .NET / C#

Generate a .gitignore for .NET, C#, and Visual Studio projects

Build a .gitignore for .NET and C# projects. Covers bin/, obj/, .vs/, *.user, NuGet packages, publish output and test results for Visual Studio and Rider — copy or download in your browser.

Why ignore the bin/ and obj/ folders?

bin/ holds compiled assemblies and obj/ holds intermediate build files; both are regenerated by MSBuild from your source on every build. The patterns are case-insensitive so they catch Bin, BIN and Debug/Release variants too.

A .gitignore builder for .NET and C# solutions built with Visual Studio or Rider. Tick the sections your project uses — bin/obj output, Visual Studio state, NuGet packages, publish output and test results — and the tool assembles a clean, labelled .gitignore.

How it works

Each toggle adds a curated block of patterns under a # Header comment. The build-output block uses case-insensitive patterns like [Bb]in/ and [Oo]bj/ so it matches whatever casing MSBuild emits, plus [Dd]ebug/ and [Rr]elease/ configuration folders. The Visual Studio block ignores .vs/, *.user and *.suo per-developer state, and the NuGet block ignores restored packages/ while keeping the build folder tracked.

What gets ignored

bin/ and obj/ hold compiled and intermediate output and are always excluded. The Visual Studio block ignores .vs/ and *.user. The Publish block ignores publish/, *.pubxml.user and *.azurePubxml so deployment settings and credentials stay out of the repo. The Test results block ignores *.trx, *.coverage and TestResults/.

Tips

Place the file at the root of your solution so the rules apply to every project. With modern PackageReference projects you never commit packages/ — packages are restored on build. If a build artifact is already tracked, run git rm --cached <file> and commit so the ignore rule takes effect. Pair this with an .editorconfig to keep formatting consistent across the team.