Skip to content
Latchkey

MSBuild "MSB1003: specify a project or solution file" in CI

MSB1003 means dotnet was invoked without a project/solution argument and the working directory has neither exactly one project nor a solution. In CI this is almost always a wrong working-directory or a checkout that did not place the project where the command runs.

What this error means

The build fails immediately with MSB1003 before any compilation. It reproduces every run for the same directory layout.

dotnet
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory
does not contain a project or solution file.

Common causes

The command runs in the wrong directory

The CI step runs dotnet build from the repo root (or a subfolder) that contains no .csproj/.sln, often because working-directory was omitted.

Multiple projects with no explicit target

The directory has several projects and no solution, so dotnet cannot pick one implicitly.

How to fix it

Point the command at the project or solution

  1. Pass the path explicitly: dotnet build path/to/App.sln.
  2. Or set the step working-directory to the folder containing the project.
  3. Re-run.
workflow
- run: dotnet build src/App/App.csproj -c Release

How to prevent it

  • Always pass an explicit project/solution path in CI commands.
  • Keep a single solution file at a known location for build steps to target.

Related guides

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