Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify which project file to use because this [directory] contains more than one project file. #6422

Open
piotrek-k opened this issue Feb 15, 2020 · 2 comments

Comments

@piotrek-k
Copy link

I've encountered a problem while trying to execute dotnet ef migrations add [migration_name] command.
While creating new project in Visual Studio 2019, I've marked an option "Place solution and project in the same directory". Here is how my project structure looks like:

λ ls
App.razor               Data/                Pages/       Shared/                       appsettings.json       docker-compose.override.yml
Areas/                  Dockerfile           Program.cs   Startup.cs                    bin/                   docker-compose.yml
BlazorApp1.csproj       Dockerfile.original  Properties/  _Imports.razor                blazor_app.sln         obj/
BlazorApp1.csproj.user  Models/              Services/    appsettings.Development.json  docker-compose.dcproj  wwwroot/

When I try to execute above mentioned command, I receive this message:

λ dotnet ef migrations add migrationname
Specify which project file to use because this 'C:\Users\piotr\Desktop\webserver\blazor_app' contains more than one project file.

It makes sense, since I've got BlazorApp1.csproj and docker-compose.dcproj which are project files in the same folder. But at the same time there is no way to specify which project I want to use.
People on the internet recommend to use -p and -s arguments, but documentation says that those arguments can specify path to the project folder not project file.
Nonetheless I tried to use them in such way, but with no luck.

C:\Users\piotr\Desktop\webserver\blazor -> origin_app (blazor -> origin)
λ dotnet ef -p BlazorApp1.csproj
Specify which project file to use because this 'C:\Users\piotr\Desktop\webserver\blazor_app' contains more than one project file.

C:\Users\piotr\Desktop\webserver\blazor -> origin_app (blazor -> origin)
λ dotnet ef -p BlazorApp1.csproj -s BlazorApp1.csproj
Specify which project file to use because this 'C:\Users\piotr\Desktop\webserver\blazor_app' contains more than one project file.

It's also worth noting I couldn't even view help to see possible parameters I could use because of this error:

λ dotnet ef --help
Specify which project file to use because this 'C:\Users\piotr\Desktop\webserver\blazor_app' contains more than one project file.

Summing up, a few things, in my opinion, should be fixed:

  • add parameter to specify which project I want to use for migration
  • OR remove "Place solution and project in the same directory" option from Visual Studio if it creates illegal project structure
  • allow to view CLI help regardless of error
@urumo
Copy link

urumo commented Oct 20, 2020

For the devs, this is still a thing

@marcpopMSFT
Copy link
Member

Old issue triage: @ajcvickers for ef. Not sure if this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants