Source control bindings in VS.NET

I spent well over an hour last night trying to get source control bindings working between VS.NET 2003 and Perforce. (Yes, I’m still on 2003, I actually prefer it over 2005–long story). I had no problem binding the sln, vcproj and a couple of files to Perforce, but the majority of the files in the project would lose their source control status a few seconds after the project loads. I tried recreating the bindings, recreating the project, “opening project from source control” and a number of other things a dozen times and VS just wouldn’t recognize these files as being part of source control.

Finally when I went to add a new file to source control I discovered that the difference between the files that worked and the files that didn’t was their location. Files in the same directory (or underneath the same directory) as the vcproj were recognized; files outside weren’t. When I attempted to add a file outside the directory I actually got a meaningful error: “Some of the files you are adding to your project are located outside of the project’s binding root. These files cannot be source controlled unless they are moved.”

Aha.. I opened up the vcproj in notepad and whaddyaknow, there’s an entry called “SccLocalPath”. I changed that from “.” to “..” and it all magically started working. It would have been nice to have gotten that error when I bound the project originally. Go Visual Studio… :-/

Leave a Reply