I’ve been tasked with setting up source control for some Visual Studio 2010 solutions. By default, VS puts its projects into “My Documents\Visual Studio 2010\Projects” which maps to something like “C:\Documents and Settings[user name]\My Documents\Visual Studio 2010\Projects”.
When checking out a solution from source control, do most people create a working folder here in this directory and work from there? (This would cause every developer to have a different working directory.) Or do they have each developer setup an identical working folder on each machine (e.g. “C:\dev\projects”)?
What is the best practice for this situation?
I’d recommend a folder with a short name at the root of a drive, e.g. “C:\Projects” or “D:\Code”. File paths are limited to 260 characters. The “My Documents” location cripples you before you even start.
Secondly, Make all paths/references within your source code relative. Then you can put the code in “C:\Code” or move it to “D:\Work” by simply editing your workspace mapping. THis is vital for allowing you to build historical versions of your codebase and keep them alongside current ones (handy sometimes) or to build the code on a build server, or in cases where developers can’t put their code in exactly the same place as you first put it. (e.g. when they run out of room on C: and have to move to D:)
Also, try ot have a common path for all developers (e.g. “Code”: but allowing a different drive letter as necessary). This allows devs to jump onto each others PCs and find stuff easily, and allows you to set up fixed antivirus exclusion folders on your antivirus server so that your build times aren’t crucified.