MSBuild "MSB1009: Project file does not exist" in CI
MSBuild was given a project or solution path that does not exist at that location. The named .csproj/.sln is wrong, the working directory is unexpected, or the file was never checked out.
What this error means
A dotnet build/restore/test step fails instantly with MSB1009: Project file does not exist and the Switch: line shows the path it tried. Nothing builds because MSBuild never found the project.
MSBUILD : error MSB1009: Project file does not exist.
Switch: src/MyApp/MyApp.csprojCommon causes
Wrong path or working directory
The path passed to dotnet is relative to a different directory than the step runs in, or has a typo, so the file is not where MSBuild looks.
File not checked out or generated
A sparse checkout, a wrong working-directory, or a project meant to be generated by an earlier step means the .csproj/.sln is absent.
How to fix it
Pass a correct, repo-relative path
Point the command at the actual project/solution path from the repo root.
dotnet build ./src/MyApp/MyApp.csproj -c Release
# verify it exists first
ls ./src/MyApp/MyApp.csprojSet the working directory explicitly
Make the step run where the path resolves, or use an absolute path.
- run: dotnet build MyApp.csproj -c Release
working-directory: src/MyAppHow to prevent it
- Reference projects/solutions by explicit repo-relative paths in CI.
- Set
working-directorydeliberately for steps that build a subproject. - Ensure checkout includes the project files (watch for sparse/partial checkouts).