MSBUILD : error MSB1008: Only one project can be specified.

Michael Torres 40 Reputation points
2025-06-11T17:27:49.1133333+00:00

I am following a tutorial from a book to learn .NET 9.

Summary:

The tutorial starts by creating Two 'projects' in a solution that will be used throughout the remainder of the book.

The projects are called 'DataContext' and 'EntityModels'

At this point in the tutorial, there really isn't any code made yet. There is a database that is created already with test data. The purpose of these projects is to create the scaffolding of the Models of the database I assume. I have 'built' the projects successfully without error.

Problem:

The book gives the instruction to run a CLI command as follows:

dotnet-ef dbcontext scaffold "Data Source=tcp:127.0.0.1,1433;Initial Catalog=Northwind;User Id=sa;Password=s3cret-Ninja;TrustCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer --namespace Northwind.EntityModels --data-annotations

When I run the above command, I get the following:

MSBUILD : error MSB1008: Only one project can be specified.

Full command line: 'C:\Program Files\dotnet\sdk\9.0.300\MSBuild.dll -maxcpucount -verbosity:m -tlp:default=auto -nologo -restore -consoleloggerparameters:Summary dbcontext scaffold Data Source=tcp:127.0.0.1,1433;Initial Catalog=Northwind;User Id=sa;Password=s3cret-Ninja;TrustCertificate=true; Microsoft.EntityFrameworkCore.SqlServer --namespace Northwind.EntityModels --data-annotations -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,C:\Program Files\dotnet\sdk\9.0.300\dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,C:\Program Files\dotnet\sdk\9.0.300\dotnet.dll'

Switches appended by response files:

Switch: scaffold

For switch syntax, type "MSBuild -help"

I am unable to find any useful documentation or helpful suggestions on what this error relates to. However, when I run the --help for dotnet ef I can see that 'scaffold' is not a command for the CLI tool.

Environment and Other Set up Data:

  • Windows 11
  • .NET 9
  • Book being used is called, "Real-World Web Development with .NET 9" by Mark J Price

I can provide the link to a github repo that has my source code on the progress so far if that helps.

Developer technologies | .NET | .NET CLI
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,766 Reputation points Volunteer Moderator
    2025-06-13T15:49:52.5433333+00:00

    as you don't specify the project and its finding more than one, its probably one of two issues:

    • you created the two projects in the same folder instead of two folders.
    • you are running the command from the projects parent folder, rather than data context project folder
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.