Excluding Files from Helix Server Control

Your workspace may include files that you do not want to add to the Helix Server repository, such as files used or generated by automated build processes.

You can use Visual Studio to exclude a file from a solution by right-clicking the file in Solution Explorer and selecting Exclude from Project in the context menu. If the file is under Helix Server control, P4VS prompts you to mark the file for delete, and after submitting the changelist that includes the deletions, the file is removed from both the project and the Helix Server repository.

You can also use Ignore Lists in P4VS to specify files or filetypes that you want to keep in your project but do not want to add to the Helix Server repository. An Ignore List is a file in your local workspace directory that contains a list of file names or file types to ignore. For example, you can create an Ignore List called .p4ignore in your project folder that contains the following:

*.swp
*~
tmp/*
.p4ignore.txt

(Note that the Ignore List file itself is included in the list.)

You can add an Ignore List file at any level of the solution hierarchy in your workspace. If you set your P4IGNORE environment variable to the file name of the Ignore List file, P4VS will not mark the listed files and filetypes for add, nor will it prompt you to do so.

Ignore Lists only affect commands that search for and add new files. If you have already marked a file for add, P4VS will no longer ignore it, even if it or its filetype appear in an Ignore List.

You can add Ignore Lists at any folder level in your workspace (or solution). P4VS applies the rules in the Ignore List at the deepest folder level relative to the file being checked, along with the rules in any Ignore Lists found in parent folders (although you can use the ! character to override higher-level rules.)

The syntax for ignore rules is not the same as Helix Server syntax. Instead, it is similar to that used by other versioning systems:

  • Files are specified in local syntax
  • # at the beginning of a line denotes a comment
  • ! at the beginning of a line excludes the file specification
  • * wildcard matches substrings

For example:

foo.txt

Ignore files called foo.txt

*.exe

Ignore all executables

!bar.exe

Exclude bar.exe from being ignored

While you can set your local P4IGNORE environment variable and add Ignore Lists manually, P4VS provides preferences and context menu options to simplify the process of adding and editing Ignore Lists.

Setting Ignore List preferences

Go to Tools > Options > Source Control > Helix Core - Ignoring Files to set Ignore List preferences, including the Ignore List file name. The file name you enter in your preferences is set by P4VS as the local P4IGNORE environment variable and used for all of your Ignore Lists. For more information about setting Ignore List preferences, see Setting P4VS preferences.

Adding a file to an Ignore List

To add a file to an Ignore List in Solution Explorer, right-click the file and select Manage Files > Add to Ignore List. P4VS adds the file to the Ignore List in the current folder. If there is no Ignore List file in the current folder, P4VS creates one. P4VS denotes an ignored file with a gray circle glyph next to the file icon.

Removing a file from an Ignore List

To remove a file from an Ignore List in Solution Explorer, right-click the file and select Manage Files > Remove from Ignore List. P4VS adds an exclusionary (!) line for the file in the Ignore List in the current folder, which overrides any Ignore Lists in parent folders.

Editing Ignore Lists

To edit an Ignore List in Solution Explorer, right-click any file in the same folder and select Manage Files > Edit Ignore List. P4VS opens the Ignore List file for edit. If there is no Ignore List file in the current folder, P4VS creates one. Use Edit Ignore List when you want to add file types using wildcard expressions.