dotnet "MSB1011: Specify which project or solution file to use" in CI
A dotnet build/test/run with no project argument ran in a directory that has more than one .sln/.csproj, so the SDK cannot decide what to build and stops with MSB1011.
What this error means
A dotnet command without an explicit project/solution fails with MSB1011 saying the folder "contains more than one project or solution file". It happens when CI runs the command from a directory with multiple candidates.
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 solution/project files in the folder
The working directory holds more than one .sln (or .csproj), so a bare dotnet build/test is ambiguous and the SDK refuses to guess.
Command run from the wrong directory
A step expected a single-project folder but ran from the repo root (or a shared folder) where several projects/solutions live.
How to fix it
Pass the explicit project or solution
Name the exact file so there is no ambiguity.
dotnet build MyApp.sln -c Release
# or a specific project
dotnet test tests/MyApp.Tests/MyApp.Tests.csprojSet the working directory to the right project
Run the command where exactly one project/solution lives.
- run: dotnet test -c Release
working-directory: tests/MyApp.TestsHow to prevent it
- Always pass the explicit project/solution to
dotnet build/testin CI. - Avoid running bare
dotnetcommands from folders with multiple candidates. - Set
working-directorydeliberately for project-scoped steps.