What .net files should be excluded from source control?

What file extensions from a .net application should be excluded from source control and why please?

  • has anyone produced an in-memory GIT repository?
  • Include Git revision number inside .NET project
  • IIS 7.5 w3wp.exe to run another process
  • How to do 'git add *' with libgit2sharp?
  • It's possible that Team Foundation Server Version Control support external repo like git
  • What's the best way to setup git when having common code that should be used in several repositories?
  • How to create a git repository with its own history from snapshots?
  • How do I add fitnesse pages to version-control?
  • Federated (Synced) Subversion servers?
  • How to remove a commit in git that has no specified branch?
  • Git without complete local copy
  • Is there an advantage to using --no-metadata in git svn clone?
  • 3 Solutions collect form web for “What .net files should be excluded from source control?”

    Depends on the project, but I’ve got the following for a Silverlight + WPF project in my .gitignore:

    # Visual Studio left-overs
    *.suo        # 'user' settings like 'which file is open in Visual Studio'
    *.ncb        # Used for debugging
    *.user
    *.ccscc      # Used for versioning
    *.cache
    
    # Editor left-overs
    *~           # (x)emacs
    *.bak        # Windows related
    \#*\#        # (x)emacs
    *.orig       # Own usage
    
    # Compiled files
    */bin/
    */obj/
    */Obj/       # git is case sensitive
    */Generated_Code/
    PrecompiledWeb
    */ClientBin
    # Windows left-overs
    Thumbs.db    # Having images in the source tree generates those files in Explorer
    

    However, the ‘.suo’ is somewhat problematic: it also contains ‘user’ settings which should have been project settings, like the startup page for a Silverlight application.

    The best and only way is to iteratively add the files to exclude. If you’re using git, using git-gui to quickly and interactively see the list of files which you’ve forgotten to exclude. Adapt .gitignore and refresh in git-gui. Iterate until the files left over are the ones you typed in.

    Some types of files are not quite clear up front. Be sure you understand all the files you check in. For example, for the RIA services in our Silverlight project we had an authentication database generated by Visual Studio which contained 2 accounts and resulted in a hefty 10Mb .MDB database file(!). Once we understood where it came from, changing it to an SQL dump reduced the size to a (still hefty) 500Kb. Constantly (re)checking prior to the checkin itself is always required, so no list is definite.

    It really depends on your build system. Check in the minimum files you need to run a full build.

    Generally, this means you exclude everything except your csproj, and *.cs files. You can probably check in your .sln file if you want.

    I got my list from this question:
    Best general SVN Ignore Pattern?

    Like any ‘list’, be sure you look over the exclusions and make sure all of them fit/don’t fit your needs, but it is a great start.

    Git Baby is a git and github fan, let's start git clone.