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
- Pass the path explicitly:
dotnet build path/to/App.sln. - Or set the step
working-directoryto the folder containing the project. - Re-run.
workflow
- run: dotnet build src/App/App.csproj -c ReleaseHow 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
MSBuild "MSB1011: Specify which project or solution to use" in CIFix MSBuild "MSB1011: Specify which project or solution file to use" in CI - dotnet build or run found multip…
MSBuild "MSB1009: Project file does not exist" in CIFix MSBuild "error MSB1009: Project file does not exist" in CI - dotnet build/restore pointed at a .csproj or…
MSBuild "MSB4057: target does not exist in the project" in CIFix MSBuild "MSB4057: The target X does not exist in the project" in CI - a /t: target name that is not defin…