After renaming our collection, we started to get build errors on our build server for the builds that were using TFS Version control. The error we got was the following:
The path ‘c:\build\appname\sources ’is already mapped to workspace ‘BuildServer_123’.
When I looked at the details of the workspace mapping using
tf workspaces /owner:*
I noticed that it was still referring to the old collection instead of the new name. That explained why TFS tried to create the workspace again, resulting in the error message above.
To fix the issue I had to clear the local TFS cache on the build server. This can be done by deleting the content of the following folder:
C:\Users\{BuildServiceAccount}\AppData\Local\Microsoft\Team Foundation\{VersionNumber}\Cache
{BuildServiceAccount} refers to the account that is used to run the build agent and {VersionNumber} refers to the used Azure DevOps version.