Skip to content
Latchkey

MSBuild "error MSB1009: Project file does not exist" in CI

MSBuild was given an explicit project or solution path that does not resolve to a file. MSB1009 is purely a path problem: a wrong working directory, a typo, or a file that was never checked out.

What this error means

dotnet build or msbuild fails with "MSBUILD : error MSB1009: Project file does not exist." and "Switch: MyApp.csproj" naming the missing file.

dotnet
MSBUILD : error MSB1009: Project file does not exist.
Switch: src/MyApp/MyApp.csproj

Common causes

Wrong working directory in the step

The build runs from a directory where the relative project path does not exist; the same path works from the repo root.

A typo or case mismatch in the path

The project name or folder is misspelled, or the case differs on a case-sensitive Linux runner.

How to fix it

Pass a path that exists from the step directory

  1. Confirm where the step runs and where the project file lives.
  2. Use a path relative to that directory, or set working-directory.
  3. Re-run the build.
.github/workflows/ci.yml
- run: dotnet build src/MyApp/MyApp.csproj
  working-directory: ${{ github.workspace }}

Match the exact filename and case

On Linux runners paths are case-sensitive; the file name must match exactly.

Terminal
ls src/MyApp/*.csproj
dotnet build src/MyApp/MyApp.csproj

How to prevent it

  • Set an explicit working-directory for build steps.
  • Match path case exactly for case-sensitive runners.
  • Verify checkout includes the project before building.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →