Today I have three interesting build errors that may happen and I want to spare you the time it took me to understand their causes.
This error may appear in your first build run: it says «An error occurred while connecting to agent name», followed by a «No build was found with the URI uri Either the URI does not exists, or user does not have the permission to access it.»
This may happen when you forget to add the TfsBuild user in the TeamProject’s [Build Services] group. This error is also logged in the Event Viewer.
This error is found deeply in the build log file.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets(997,5): error MSB3491: Could not write lines to file "solution_path_here.sln.configuration_here.vsprops". Could not find a part of the path solution_path_here.sln.configuration_here.vsprops'.
You changed the solution’s name or its location in the Version Control, but you forgot to update the solution’s path in the TFSBuild.Proj file.
Build failed, ok, but what is this error?
«warning : TF42097: A work item could not be created due to a field error. The following fields have incorrect values: Field: 'field_name_here' Value: '' maybe_more_fields_after»
The TeamBuild script is trying to create a Bug-type workitem, to signal the build failure, but the field has no default value. You customized, or worse, used a customized template, that is missing that default.
It happened to me with the Conchango’s SCRUM Template: it has no Reason field. Removing the Reason field from the WorkItemFieldValues solved the issue.