Reputation:
I have Net Core 3.1.1000 installed. Now we are trying to run ef migrations with EF Core 2.2.6 database previous Solution,
when running the following, receive error below.
dotnet ef migrations add InitialCreate
The application to execute does not exist: .dotnet\tools.store\dotnet-ef\2.2.6-servicing-10079\dotnet-ef\2.2.6-servicing-10079\tools\netcoreapp2.2\any\dotnet-ef.dll'.
How can we resolve this?
How Can I point directly to the DLL target directory and execute? I heard renaming file directory is not good idea.
I see the real dll is located here:
....dotnet\tools.store\dotnet-ef\2.2.6\dotnet-ef\2.2.6\tools\netcoreapp2.2\any\dotnet-ef.dll
already ran this and installed this: dotnet tool install --global dotnet-ef
Upvotes: 7
Views: 2648
Reputation: 1080
How about running the below command in Visual Studio's Package Manager Console.
add-migration InitialCreate
Upvotes: -1
Reputation: 3405
Solution
To fix it, you should follow these two steps.
Install EF tool as a local or global tool. Open your terminal and run: dotnet tool install --global dotnet-ef
.
From .NET Core v3, the EF tool is no longer part of the .NET Core SDK.
Github issue #14016 / Microsoft Breaking Changes
Install the previous .NET Core SDK. .NET Core v2.2
To Reproduce This Error
I created a clean virtual machine and I just installed .NET Core v3. Then, I ran the command dotnet ef migrations add InitialCreate
as you mentioned. I got the following error:
So I installed the previous .NET Core SDK version (v2.2) and the problem was solved.
Recommendation
Microsoft does not recommend using .NET Core version 2.x.x. These releases have reached the end of life, meaning it is no longer supported. They recommend moving to a supported release, such as .NET Core 3.1.
Upvotes: 3