Buying a fancy new computer is always fun (twice the memory! twice the CPU cores!) but there’s always the hassle of installing all of the necessary software. For me as a programmer that includes Visual Studio 2010, and Perforce, my preferred version control software (an excellent tool and free for limited use). Getting these working properly can be a pain.
After my most recent upgrade I changed the server name, which then changed the connection string (used by Visual Studio to find the version control server, hosted on the same machine) which led to this error message whenever I opened a project:
In text (for indexing purposes) that is: “The associated source control database could not be accessed. Temporarily work offline in disconnected mode…”
It seems pretty straightforward. Update the bindings, and you’re all set. Even though ‘manually change bindings’ is listed as being advanced, it’s really not particularly complicated. Select all the projects, click Browse, your new server is the default so you hit enter, and now you’re under version control again. Sweet!
Except, the next time I loaded the project, I got the same dialog:
I tried this about a dozen times on multiple projects with every variation I could think of. Nothing worked. Finally I did a search through all files for the old server name (bruced_OldServer in the slightly faked example above) and replaced it with the new name. This is easier than using the GUI and, it actually works. After this change Visual Studio effortlessly connected to Perforce, and I could get on with my work.
The connection strings are found in MSSCCPRJ.SCC files, which are normal text files that can easily be globally searched and replaced.
I investigated to find out what was going on by using SysInternals Procmon and sort of figured out what was happening. Every time I changed the connection string Visual Studio rewrote the MSSCCPRJ.SCC files – with the old connection string.
I don’t know if this is a bug in Perforce or in Visual Studio 2010. Either way it’s busted, but can easily be fixed once you know what files to manually change.
This advice comes with no warranty – I don’t understand the issues well enough to guarantee that this will always work – but it saved me from a ton of hassle. Back up the .SCC files first, and give it a try.