Skip to content

Default .NET gitignore

Shawn South edited this page Feb 5, 2014 · 1 revision

There are a variety of files that should not be checked in to source control. Git allows this to be configured on several different levels, but it is best to include a .gitignore file in the repository itself to ensure that other developers, who may not have correct configurations, don't accidentally add such files to the repository.

Start with the default VisualStudio file provided at http://gitignore.io/api/visualstudio. To create the .gitignore file directly from the command line,

$ wget -O .gitignore http://gitignore.io/api/visualstudio

Next, enable NuGet package restore by uncommenting the appropriate line. Also, add another pattern for package folders in project sub-folders:

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
packages/
*/packages/

Finally, add the following patterns:

# ignore all except example .config & project files files
**/_[Cc]onfig[Ss]ource/*.config
!**/_[Cc]onfig[Ss]ource/EXAMPLE-*.config

# Red-Gate SQL Data Compare project files
*.sdc
!EXAMPLE-*.sdc

Clone this wiki locally