Search code examples
tfstfignore

Recursively ignore within a structured repo using .tfignore


I have a solution with multiple projects. Each project uses a given Nuget that installs resources in some folders thar are shared with custom files. Something like

Solution
  ProjA
    Resources
      Text <from nuget>
      Img
    Text
  ProjB
    Resources
      Text <from nuget>
      Img
    Text

I already tried adding .tfignore at the solution level with Resources/Text But it doesn't work. The only way I succeeded was to copy the .tfignore into each project folder. Is there any better way?


Solution

  • .tfignore file will ignore the given pattern in all subdirectories . And it will ignore files or folders with the given name. For folders, it will apply recursively.

    As a result, a .tfignore with:

    Text
    

    This will ignore any folder named Text in your filesystem hierarchy, and it will ignore them recursively.

    For those Text folder which is not under Resources/Tables you can create .tfignore files in sub-folders to override the effects of a .tfignore file in a parent folder.

    Note:

    1. A filespec is recursive unless prefixed by the \ character.

    2. This .tfignore file will not affect with those files already in source control. You need to remove them from source control first. Also make sure your .tfignore files have checked in source control.