Setting Helix Core Server environment variables using P4CONFIG
P4CONFIG
is an environment variable that you can use to
point to a file that stores other
Helix Core Server
environment variables. The current working directory and its parents are
searched for the file. If the file exists, then the variable settings
within the file are used.
P4CONFIG
makes it easy to switch
Helix Core Server
settings when switching between different solutions or projects. If you
place a configuration file in each of your client workspaces and set
P4CONFIG
to point to that file, your
Helix Core Server
settings change to the settings in the configuration files automatically
as you move from directories in one workspace to another.
To use P4CONFIG
to switch settings between client
workspaces on
P4VS, you must create
separate Visual Studio shortcuts for each workspace, setting the
Start in
property as the workspace directory (which is also
the directory where the configuration file resides). If you launch Visual
Studio using a shortcut defined this way,
P4VS
will read the
Helix Core Server
settings from the configuration file in that workspace’s directory. This
is required because Visual Studio otherwise uses its own directory as the
current working directory.
To use P4CONFIG
with
P4VS:
- Create a configuration file that contains the Helix Core Server environment variable settings you want, and put it in the workspace directory for the relevant Visual Studio solution.
- Using
p4
, the Helix Core Server Command Line Client, unset theP4CLIENT
,P4PORT
, andP4USER
environment variables and setP4CONFIG
to the configuration file name. - Using P4VS, go to Tools > Options > Source Control > Helix Core - Connections and select Connect to the server using my Helix Core environment settings.
-
Create a Windows desktop shortcut for Visual Studio that is dedicated to the workspace with which you want to use the configuration file.
- Right-click on the desktop and select New > Shortcut.
- Enter the location of the Visual Studio executable and click Next.
- Enter a shortcut name and click Finish.
- In the shortcut properties, under Start in, enter the workspace directory where the configuration file is located, and click OK.
Repeat for each workspace for which you want a different configuration file.
- Whenever you want to work in that workspace using the configuration file settings, use the shortcut to launch Visual Studio.
For more information about P4CONFIG
and
Helix Core Server
environment variables, see the
Helix Core Command-Line (P4) Reference
and
Setting P4VS preferences.