Cannot connect to P4 using P4Config

May 1, 2014 at 9:39 AM
Hi, I have just moved from P4VS to VS2P4 (1.87).

It seems to work well (and it is much, much lighter than P4VS) but I cannot get it to connect to P4 automatically using P4Config. Manually setting the connection parameters works fine instead.

My P4CONFIG env var is set to ".p4config", and I have a file named .p4config at the root of my checkout (I tried moving the file to the sln directory, but it didn't change anything). The file contains the correct values for P4CLIENT, P4PORT, P4USER. This configuration seems to be valid (e.g. P4 shell extensions work correctly).

When I try to test the connection though, I get a "Not a valid workspace" message. The VS2P4 log shows the line:
Error: P4Service.Connect() ArgumentException unable to connect. Server perforce:1666, Workspace <my machine name>
so it seems that it is not finding/parsing the .p4config file and using the default connection settings.

Any idea about this?
Coordinator
May 2, 2014 at 5:23 PM
I tested this on my machine with an env var like that, and I couldn't reproduce the problem; it worked well. So I don't have a good suggestion. You might go to the same directory as your .sln file (using the command line), and enter P4 Info and P4 Set to make sure everything is okay at that level. Also make sure you can do a p4 checkout at the command line at that location.
Sorry I can't be more helpful.
May 6, 2014 at 3:49 PM
P4 info/set and checkouts work correctly. Any other idea how to debug this?
Coordinator
May 8, 2014 at 2:54 PM
If you want to email me at B.DaleA [at] gmail.com, I can send you a debug version of the .vix file. I'll need to know what version of Visual Studio you're on.
It's a long shot, but maybe it will help.
First, you might try simplifying it:
  1. Name your file P4.cfg. It might be choking on .p4config (probably not, but I'm not sure).
  2. Put the minimum info in P4.cfg. Here is one of mine:
    P4CLIENT=dalebpc_core
    P4PORT=perforce:1666
  3. Are you using passwords? I haven't tested that.
May 9, 2014 at 10:53 AM
Ok, it seems to have fixed itself. I was using VS2012 initially. I have tried it on VS2010 on another branch, and it worked without problems. Then, without doing anything else, it started working also on the first sln with VS2012.
Thanks anyway!
May 9, 2014 at 11:52 AM
That was too soon. I got the problem again, but I have focused it down to when I run multiple VS instances at the same time. Running just one instance is perfectly fine, but as soon as I open two at the same time they all break (which means, the following time that I open any one of them, it won't find the correct connection settings). Deleting the .suo files makes them working again until the next time they run concurrently (which explains why I didn't get the problem on a new branch).