dotnet "error MSB1011: Specify which project or solution" in CI
A dotnet command (build, test, run) found more than one project or solution in the folder and will not pick for you. MSB1011 asks you to name the exact file to operate on.
What this error means
dotnet test or build fails immediately with "error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file."
MSBUILD : error MSB1011: Specify which project or solution file to use because this
folder contains more than one project or solution file.Common causes
Multiple projects or solutions in the working directory
The folder holds two .csproj files, or a .csproj and a .sln, so the command cannot infer a single target.
A command run from the repo root
Running dotnet test at the root of a multi-project repo gives the CLI nothing unambiguous to act on.
How to fix it
Name the project or solution explicitly
- Decide which solution or test project the step should target.
- Pass its path as the first argument to the command.
- Re-run the step.
dotnet test tests/MyApp.Tests/MyApp.Tests.csprojPoint at the solution to cover all projects
For a build or test across the repo, pass the .sln so the CLI has a single, explicit target.
dotnet test MySolution.slnHow to prevent it
- Always pass an explicit project or solution path in CI.
- Keep one solution that references the projects you build and test.
- Avoid running ambiguous commands from the repo root.