Azure Pipelines "error MSB1009: Project file does not exist"
MSBuild was given a project or solution path that does not exist on the agent. The checkout layout or a wrong glob in the build task pointed it at a file that is not there.
What this error means
A VSBuild, MSBuild, or DotNetCoreCLI step fails with MSBUILD : error MSB1009: Project file does not exist. and the path it tried.
MSBUILD : error MSB1009: Project file does not exist.
Switch: src/App/App.csproj
##[error]The process 'C:\...\MSBuild.exe' failed with exit code 1Common causes
Wrong path relative to the checkout root
The projects or solution input is relative to a different directory than where the repo checked out, so the file is not found.
A glob that matches nothing
A pattern like **/*.sln matches no file because the project lives in a sub-repo or was not produced by an earlier step.
How to fix it
Point at the project from the sources root
Use a path relative to the working directory and confirm it exists. $(Build.SourcesDirectory) anchors the checkout root.
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: '$(Build.SourcesDirectory)/src/App/App.csproj'List files to confirm the path
- Add a step that runs
lsordirat the expected directory. - Compare the real path to the one in the build task.
- Fix the glob or path so it resolves to one real project or solution.
How to prevent it
- Anchor build paths to
$(Build.SourcesDirectory). - List the directory in CI when a path is uncertain.
- Verify globs match exactly one solution or project.