Setting Perforce preferences
To set Perforce preferences in Visual Studio, go to
Tools>Options. You can specify preferences on the following
nodes in the Options dialog under Source Control:
You can specify keyboard shortcuts for P4VS commands
Set the following preferences to determine how you connect to the shared
Perforce service in Visual Studio:
When opening a project under source control:
- Show the Perforce Connection dialog: Prompt for
connection settings whenever you open a project that is under Perforce
- Connect to the server using my most recent settings:
Without prompting for connection settings, reconnect to the Perforce
service you were connected to during your last session.
- Connect to the server using solution-specific settings:
Without prompting for connection settings, connect to the Perforce
service you last used for the solution or project that you are opening.
- Connect to the server using my Perforce environment
settings: Connect using Windows environment variables for Perforce
connections, which you set using the Perforce Command-Line Client or P4V,
the Perforce Visual Client. For more information, see the Perforce
User's Guide or the P4V help.
Opening and closing connections:
- Use IP-specific tickets when logging in: Specifies
whether your login ticket is restricted to the IP address from which you
- Automatically log off when closing a connection:
Specifies whether your ticket is invalidated when you log out.
Set the following preferences to determine how P4VS retrieves data from the
shared Perforce service:
- Check server for updates every: Specifies how often P4VS
checks the Perforce service for updated file information. Frequent checks
enable P4VS to display current file status but increase the workload on the
- Maximum number of files displayed per changelist:
Specifies the maximum number of files displayed in a changelist, to help
minimize the time required to handle and submit very large changelists.
This setting affects only the display of changelists, and does not limit
the number of files that a changelist can contain.
- Maximum size of files to preview: Limits the size of
image files displayed in the Preview tab, to limit the amount of image data
sent from the Perforce service to P4VS.
- Number of changelists, jobs, or labels to fetch at a
time: Specifies the number of specifications read in each batch
fetched, to minimize server load and maximize P4VS performance. To retrieve
all entries, specify 0.
- Automatically update file status when selection changes:
Select to enable the Perforce status badges in Solution Explorer to update
automatically when you click or hover over the file icon, without having to
click Refresh. Deselect to improve performance.
To set the default diff application, select one of the following:
- P4Merge: Perforce's companion diff tool.
- Other application: Browse to your preferred diff
To specify arguments for third-party diff applications, enter %1 for the
name of the first file and %2 for the name of the second file in the
Arguments field. Perforce replaces these placeholders with the actual
filenames when calling the diff application.
To set the default merge application, select one of the following:
- P4Merge: Perforce's companion merge tool.
- Other application: Browse to your preferred merge
To specify arguments for third-party merge applications, enter the
following replaceable parameters in the Arguments field:
- Base file: %b
- Their/Source file: %1
- Your/Target file: %2
- Result file: %r
Perforce replaces these placeholders with the actual filenames when
calling the merge application.
Set the following display and file behavior preferences:
- Use OS format for dates: Use the date format that the
operating system uses.
- Format dates using Perforce standard (yyy/mm/dd hh:mm:ss):
Use the Perforce format.
Files and folders:
- Warn before reverting files: Specifies whether P4VS
displays a prompt before reverting files.
- Lock files on checkout: Select to lock files every time
you check them out. Locks prevent other users from checking in changes
while you work on a file.
- Prompt for changelist when checking out or adding files:
Specifies whether P4VS prompts you to choose a changelist when you add or
check out files.
- Automatically add new files to Perforce: Select if you
want P4VS to mark new files for add in a pending changelist.
This option works together with the Prompt for changelist when
checking out or adding files option to determine prompting
behavior when you add new files to a project or solution that is under
- If both this option and the Prompt for changelist option are enabled,
P4VS prompts you to mark new files for add.
- If this option is enabled and the Prompt for changelist option is
disabled, new files are automatically added to the default changelist
without any prompt.
- If this option is disabled and the Prompt for changelist option is
enabled, no prompts will appear; you must manually mark new files for
- Update related projects when reverting moved files:
Select to revert file renames or moves in Visual Studio when you revert a
Perforce rename/move operation.
If you do not select this option, Visual Studio continues to show the
new file name or location despite the fact that Perforce has reverted the
file to its original name or location.
Note. If you revert a folder rename/move in P4VS, you
must manually revert the name or location in Visual Studio, regardless of
your preference selection.
- Use Visual Studio to view file versions: Select to view
previous revisions of a file (from the File History dialog, for example) in
a Visual Studio editor window.
You can use this option to view file revisions or shelved files the same
way that you would view an editable file in the Visual Studio IDE.
- Treat Solution/Projects as directories when selected:
Select to treat solutions and projects as directories when P4VS runs
Use this option to improve performance when loading solutions with a
large number of projects or projects with a large number of files.
Project and solution files:
- Tag project and solution files as controlled by P4VS:
Select to enable P4VS to write tags to the solution and project files that
are under Perforce control. The default is not to tag project and solution
files; P4VS does not need to tag these files to know that they are under
- Set the location of new projects to the current workspace root
directory: Select to put new projects in the current workspace
root directory. The Location field in the New Project dialog will be
populated by default with the current workspace directory.
To avoid adding and checking in files that do not belong in the repository,
you can exclude individual files or file types (for example, build or release
artifacts) from source control using Ignore Lists. For more information, see Excluding files from Perforce.
You can set the following preferences:
- Enable Ignore Lists for specifying files to ignore when marking
for add: Select to enable P4VS to use Ignore Lists to keep
individual files or file types from being added to the Perforce repository.
If you have already set an Ignore List file as the
environment variable on your local machine, that file name appears by
default in the Name field. If not, enter a file name or
accept the standard default,
.p4ignore.txt. The first time you
select Edit Ignore List or Add to Ignore List for a file in a folder in
Solution Explorer, P4VS adds an Ignore List file with this file name to
Note. Your local
variable will be updated with the file name that you enter here. If other
Perforce clients (such as P4 or P4V) on your local machine use Ignore List
files, be sure to use the same file name as you use with those clients.
- Automatically add new Ignore Lists to solution or
project: Select to have new Ignore Lists appear in the Solution
If you do not select this option, the Ignore List file will be hidden in
- Prompt when creating a new Ignore List: Select to have
P4VS prompt you when you select Add to Ignore List in Solution Explorer to
add an Ignore List to a folder that does not yet have one.
If you do not select this option, the system creates the Ignore List
- Automatically ignore new Ignore Lists (add Ignore Lists to
themselves): Select to have P4VS automatically add the Ignore List
file to itself to prevent the Ignore List from being added to the Perforce
- Automatically add new Ignore Lists to Perforce: Select
to have P4VS automatically add new Ignore Lists to the Perforce depot.
This option works only when the Automatically ignore new Ignore
Lists (add Ignore Lists to themselves) option is not selected. If
that option is not selected, and you do not select the
Automatically add new Ignore Lists to Perforce option,
then you must manually mark the Ignore List file for add to add it to the
Set the following logging preferences. You can view P4VS log messages in the
Output window in Visual Studio if you select Perforce Source Control
in the Show output from: drop-down list in the Output
- Show p4 reporting commands: Specifies whether the Output
window in Visual Studio displays all commands issued by P4VS, including
commands issued by P4VS to obtain status information from the Perforce
- Show p4 command output for file operations: For verbose
log messages, enable this option.
- Enable logging to file: Logs P4VS activity to the
- Name: Specifies the name and
location of the log file.
- Size: Specifies the maximum
size of the log file.
Go to Tools>Options>Environment>Keyboard. You can
find P4VS commands by entering
P4VS in the Show commands
For more information about creating keyboard shortcuts in Visual Studio, see
the Microsoft Visual Studio help.