Teamcity doc says ‘uses standard Perforce environment variables as global variables’. These are set according to p4 set
$ p4 set
P4CLIENT=aa (set)
P4EDITOR=C:\Program Files (x86)\Notepad++\notepad++.exe (set)
P4IGNORE=C:\Code\p4ignore.txt (set)
P4PASSWD=AA63AEBCFF2322ED61DB0B04D45 (set)
P4PORT=srvcrpsys52:1666 (set)
P4USER=irving.washington (set)
Yet Teamcity in Visual studio gives me this error when I try to test the connection. What’s going on?

Environment Variables are not exactly the same as ‘p4 set’ variables. ‘p4 set’ can record things in the registry, in a place where Perforce tools know to look, but other tools may not know to look there.
Try using real Environment Variables, by going into your Start menu for “About This Computer”, navigating to the Environment variables table, and setting the environment variables there ( and possibly re-logging in or re-booting after setting them; depending on whether you made them User environment variables or System environment variables ), then see if TeamCity recognizes the settings.
You can tell that you have set real Environment Variables because the command-line prompt shows them if you do:
Note that this is ”’different”’ from