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.
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.
- 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.