Home > Mobile >  How to fix "Specify which project or solution file to use" error where there's only o
How to fix "Specify which project or solution file to use" error where there's only o

Time:07-16

Doing a dotnet ef dbcontext scaffold command, I got this error I hadn't gotten before in this project:

MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.

There is only one project in the folder (and a .sln file) and in the past I haven't gotten this error.1 A search of Stack Overflow turned up multiple questions, but their answers (where they exist) were either multiple projects in the folder or environment issues.

How do I get the command working again?


1 I see multiple answers saying it won't work if you have both a .csproj and a .sln in the same folder. It does (or at least, did) work for me.

CodePudding user response:

It's unclear why they use that error message for it, but the problem was that I had the project running in Visual Studio. (Doh!) Apparently, when the project is running, this is the error it gives you (as opposed to, say, something telling you the project is running and that it can't do its job when the project is running). Stopping the run made the command work again.

  • Related