Best way to create a .gitignore for .NET projects

Best way to create a .gitignore for .NET projects

Try `dotnet new gitignore` on your CLI ๐Ÿค–

ยท

1 min read

Table of contents

TL;DR

dotnet new gitignore

Built-in since .NET Core 3.0 ๐Ÿคฏ

Story behind

I just started learning .NET, so I'm creating a lot of projects, it's been a great experience so far ๐Ÿš€

I usually publish my projects as open source on Github, so it wouldn't look nice if they include obj/, bin/, or other specific editor things included. Storing such files is messy and even dangerous in some cases.

Example: You could forget to clean from those artifacts your secret password โš 

Coming from other ecosystems, I used to visit gitignore.io to solve this problem, but it's something I always looked to optimize.

This problem is solved elegantly on .NET ๐Ÿคฉ

I recommend you to visit the remaining documentation of dotnet new, it includes many great and useful things that I will be documenting little by little in future blogs!

Good luck!

ย