Closed niyeshiw closed 6 years ago
@niyeshiw You should change the current working directory (so you're in the project directory) or use the --project option.
I'm experiencing the same issue. My project is already selected as Default project but I'm receiving the same error. I also used the --project option but still don't work: dotnet ef migrations add InitialCreate --project "C:\path_to_my_project\MyProject.csproj"
or even dotnet ef migrations add InitialCreate --project="C:\path_to_my_project\MyProject.csproj"
I'm using VS2017 and .NET Core 2.1
@eSPiYa Please file a new issue and include a project/solution that demonstrates the behavior you are seeing.
@eSPiYa , I get same issue. Could you find any solution?
I'm also getting this issue. Was there a solution?
I'm using this command:
dotnet ef migrations script --verbose -i --project "C:\path\to\proj\proj.csproj"
@Elvin1492 , @ageisen2000: I think that we had a problem with EF Core Tools v2.1 rtm. I found a work around: you open a new command line and cd to directory that you would like to run the migrations.
cd "D:{path_to_your_projet}" dotnet ef migrations add initial
That should be working.
I'm having the same issue:
PM> dotnet ef Scaffold-DbContext No project was found. Change the current working directory or use the --project option.
Despite having Default Project set. Using EF Core 2.2
The provided solution didn't help me. I've faced the same issue and done a workaround for it.
Instead of using the Package Manager Console, I've used the command line in that same folder . Then 'dotnet' it gave me a helpful error message: (yours might be different)
No database provider has been configured for this DbContext. A provider can be configured by overriding the DbContext.OnConfiguring method or by using AddDbContext on the application service provider. If AddDbContext is used, then also ensure that your DbContext type accepts a DbContextOptions<TContext> object in its constructor and passes it to the base constructor for DbContext.
Then I moved on to do the configuration steps.
What is the solution, i am experiencing same issue in .NET core 3.2 console application
@ehsansajjad-synergy Please open a new issue and include a small, runnable project that reproduces the behavior you are seeing.
I had trouble with this too, but I moved one level further into the directory of the project. Instead of "/Users/xxx/Projects/RazorPagesMovie" I moved to "/Users/xxx/Projects/RazorPagesMovie/RazorPagesMovie" and ran the dotnet ef migrations add initial command and got a successful build...
I had trouble with this too, but I moved one level further into the directory of the project. Instead of "/Users/xxx/Projects/RazorPagesMovie" I moved to "/Users/xxx/Projects/RazorPagesMovie/RazorPagesMovie" and ran the dotnet ef migrations add initial command and got a successful build...
this is legit. and if your using mac don't forget to cd to change the directory.
The run path must be in the <Yourproject>.csproj
sibling directory
dotnet ef migrations add InitialCreate --project ProjectName(replace by your projectName using EF)
do not use Nuget console. Click on right on your project name in solution explorer and Open in Terminal...
I had this problem too, but I solve it
i want to use migrations to create the database from my model, i run dotnet ef migrations add InitialCreate,but it show "No project was found. Change the current working directory or use the --project option".what should i do?