Error Knowledge Base .NET MSB1003

MSB1003: Specify a project or solution file

MSBuild was invoked without a project or solution argument in a directory that contains no buildable project or solution.

Fix it fast

Most likely: The build command ran from a directory that does not contain a .sln, .csproj, .vbproj, or .fsproj, and no project path was passed.

1. Confirm this is your error
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
2. Check the cause
pwd
ls
find . -maxdepth 3 \( -name "*.sln" -o -name "*.csproj" -o -name "*.vbproj" -o -name "*.fsproj" \)
3. Apply the safe fix
# Run from the project/solution directory.
cd path/to/project-or-solution
dotnet build

# Or pass the project/solution path explicitly.
dotnet build path/to/app.csproj
dotnet build path/to/app.sln
4. Verify it works
dotnet build path/to/app.csproj
dotnet test path/to/app.sln
Don't use unsafe shortcuts
  • Do not rely on the CI default working directory without printing or setting it.
  • Do not add a new project file until you confirm the existing project path is correct.
  • Do not hide this in scripts, pass an explicit project or solution path.

What .NET Is Rejecting

MSBuild was invoked without a project or solution argument in a directory that contains no buildable project or solution.

Fix the command

Run from the folder containing the .sln or .csproj, or pass an explicit path such as dotnet build path/to/app.csproj.

In CI, print pwd and list files before running build.

If needed, create a project with dotnet new and use the appropriate template.

Validation

Re-run the failing command and confirm the original code/message is gone, and confirm expected artifacts or outputs exist (packages restored, build/publish succeeds).

Why the Command Was Rejected

Usually this comes down to the command ran from the wrong working directory, the repo checkout is incomplete or you are in a folder without a project file, or a script changes directories before invoking build.

Re-run the Minimal Correct Command

dotnet build succeeds without MSB1003.

Outputs appear under bin/ and obj/.

Mechanism

This is the part worth understanding if the quick fix did not hold. It explains what .NET is trying to do at the moment the error appears.

dotnet build forwards to MSBuild.

If no .sln or .csproj is specified, MSBuild searches the working directory, if none is found, MSB1003 is raised.

Avoid Command and Config Drift

To prevent this, avoid relying on the implicit working directory, pass explicit project or solution paths, and centralize build commands in a script that sets the correct paths.

Need help or found a mistake? Contact RepoFlow support for questions.

Join our mailing list