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

Comments

  • Anonymous
    January 24, 2017
    I have the same problem. I can't find solution.
  • Anonymous
    January 24, 2017
    Check the build logs to see where the build agent is downloading the source and compare to where MSBuild is looking for solution file. Sometimes, there appears to be a difference between the location of source and where MSBuild is starts searching for the solution file and the error occurs.Another method to resolve the error is to go one level up in the source code tree in the repository mapping to ensure all source is downloaded. I have seen customer set the repository mapping at the project level and not the solution level in the source control tree and the build fails.
    • Anonymous
      November 21, 2018
      Thanks! Fixed the directory path and all is good!
  • Anonymous
    June 16, 2017
    Thanks for the info! Solved my problem :).