TFS gives "is already mapped in workspace" error if "Server Url" option or "Working Folders" mapping is changed.
We use following workaround for now:
Code for "Pre-execute action" of TFS checkout step:
// folders listed in the "Working Folders" mapping option
def inDir = new File(configuration.workspaceDir, "lcl/in")
def outDir = new File(configuration.workspaceDir, "lcl/out")
// create them as workspace might be cleaned up before
//execute unmap command
logger.info("In dir: " + inDir)
util.execute("tf workfold /unmap .", inDir)
util.execute("tf workfold /unmap .", outDir)
Please add unmapping option before checkout is made for TFS Repositories.
Though that might produce large number of detached mappings, so any other solution that removes workspace before checkout will suffice.