Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A .gitignore file for a .NET developer
#Junk Files
*.DS_Store
[Tt]humbs.db
#Visual Studio Files
[Oo]bj
[Bb]in
[Dd]ebug
[Bb]uild/
*.user
*.suo
*.exe
*.pdb
*.aps
*_i.c
*_p.c
*.ncb
*.tlb
*.tlh
*.[Cc]ache
*.bak
*.ncb
*.ilk
*.log
*.lib
*.sbr
*.sdf
ipch/
*.dbmdl
*.csproj.user
*.cache
*.swp
*.vspscc
*.vssscc
*.bak.*
*.bak
#Tools
_ReSharper.*
_ReSharper*/
*.resharper
*.resharper.user
[Nn][Dd]epend[Oo]ut*/
Ankh.NoLoad
#Other
.svn
# Include DLLs if they're in the NuGet packages directory
!/packages/*/lib/*.dll
!/packages/*/lib/*/*.dll
@cubny

This comment has been minimized.

Copy link

cubny commented Aug 2, 2011

New Folder

@mahdi

This comment has been minimized.

Copy link
Owner Author

mahdi commented Aug 2, 2011

:-)

@SalmanAA

This comment has been minimized.

Copy link

SalmanAA commented Aug 2, 2011

App_Data folder, because of it replaces main database sometimes!

@jtwebman

This comment has been minimized.

Copy link

jtwebman commented Aug 13, 2011

Nice Thanks!

@pontusm

This comment has been minimized.

Copy link

pontusm commented Aug 14, 2011

I believe that ignoring *.resharper files is actually wrong. Those file contains Resharper settings that everyone on the project should follow, such as formatting rules for instance.

@pontusm

This comment has been minimized.

Copy link

pontusm commented Aug 14, 2011

And in addition, you have excluded *.user which means that you don't need to also specify *.csproj.user and *.resharper.user :)

@mahdi

This comment has been minimized.

Copy link
Owner Author

mahdi commented Aug 14, 2011

I have put *.resharper because some people in your team may not use ReSharper. In my own case we have some guys without ReSharper installed on their machines.

@pontusm

This comment has been minimized.

Copy link

pontusm commented Aug 14, 2011

Ok, but that file does no harm for those who do not have Resharper so I think it's perfectly fine to keep it in.

@mahdi

This comment has been minimized.

Copy link
Owner Author

mahdi commented Aug 14, 2011

Maybe, but in my own experience, those team members who don't use ReSharper prefer to have a clean code directory without any extra files! Anyway, thank you for your feedback :-)

@paigecook

This comment has been minimized.

Copy link

paigecook commented Aug 16, 2011

This is a very nice .gitignore file. I have been using the one I outlined here: https://gist.github.com/1024746

Main differences are in the following sections:

  • packages
  • logs and databases
  • pro power tools
  • include of Nuget packages, as we like to have them in the repository.
@mahdi

This comment has been minimized.

Copy link
Owner Author

mahdi commented Aug 16, 2011

@paigecook: Yours seems much more complete :-)

@arashkarami

This comment has been minimized.

Copy link

arashkarami commented Oct 31, 2011

thanks

@sahinci

This comment has been minimized.

Copy link

sahinci commented Dec 18, 2012

*.dbmdl is in ignore list but vs2010 and git extesion still show it and not ignoring

@nakhli

This comment has been minimized.

Copy link

nakhli commented Feb 14, 2013

!/packages//lib/.dll doesn't seem to work.

@betobaz

This comment has been minimized.

Copy link

betobaz commented Apr 5, 2013

Other or (Git)

*.patch

@beginor

This comment has been minimized.

Copy link

beginor commented Apr 10, 2013

XamarinStudio(MonoDevelop) user prefs

*.userprefs

@vicentesuc

This comment has been minimized.

Copy link

vicentesuc commented Apr 1, 2020

if you are working on visual studio 2019 , dont forget add . in my case im developing using .net core

.vs/

@lavakeshpandey

This comment has been minimized.

Copy link

lavakeshpandey commented Jun 4, 2020

Cool, very helpful. Copied it.

@lavakeshpandey

This comment has been minimized.

Copy link

lavakeshpandey commented Jun 4, 2020

Can we also add .vscode files to gitignore? I think it won't be able to run the project when cloned but I guess vscode gives us an option to add assets to run/debug the program wherever it doesn't find one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.