MSB1009: Project file does not exist for TFS Visual Studio Build Task

If your Visual Studio build task fails with the following error code MSB1009: Project file does not exist, you probably omitted the actual solution file in the Solution text box. This indicates the solution file to build for the Visual Studio build task.

The following shows just the folder path and this setting produces the error:

Incorrect Setup

 

 

This is the correct setting with the solution file to build:

Correct Setting

 

 

This setting has been a source of confusion due to the heading on the dialog to select the Path and not say select the Path to the Solution file

heading

 

 

 

 

 

The other option for the build that could cause this issue is not having the correct repository mapping for the solution to ensure the files are downloaded to the build machine. The repository option within the build definition specifies the source to download from TFS to the local build agent https://www.visualstudio.com/en-us/docs/build/define/repository