After following steps in this link, I found that my projects would still not build correctly.
The error I got in the build was:
"The path C:\Documents and Settings\myBuildServiceUser\Local Settings\Temp\myProject\Build1\Sources\WindowsFormsApplication1 is already mapped in workspace myBuildServerMachineName_16."
To fix this problem you need to delete all workspaces on the build server (owned by the user account that the build service runs as) - these are named buildservername_nn where buildservername is your build server name and nn is a number it assigns as it generates them (upon the first time a build is run). It appear that these old workspaces are incompatible with the MSBuild 4.0 engine - hence we delete them so it can re-create them upon next build.
To get a list of all the workspaces on the build server use this command:
tf.exe workspaces /owner:myTFSBuildServiceUser /server:myTFSServer /computer:myBuildServerMachineName
tf.exe is run from the VS command prompt (TFS/VS2008 install dir: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE).
or just run a build - to get the error message mentioned above - this will provide the problem workspace name (eg myBuildServerMachineName_16).
The following command will delete a workspace:
tf.exe workspace /delete /server:myTFSServer workspaceName;myBuildServerUser
See this article for how to delete workspaces.
Attrice's Team Foundation Sidekicks provides a nice GUI to both view and remove workspaces.
UPDATE 21 September 2010:
Updated/re-written to correct a number of things.
If you get the following error:
"TF30076: The server name myTFSServer provided does not correspond to a server URI that can be found. Confirm that the server name is correct."
Then you will need to specify it's full URI eg:
tf.exe workspace /delete /server:http://myTFSServer:8080 myBuildServer_16;myBuildServerUser
See this article regarding this error.
HTH
Tim