Entity Framework Core: troubleshooting
Project does not appear in the 'Startup projects' field
Check that the desired project satisfies the following requirements:
Microsoft.EntityFrameworkCore.DesignorMicrosoft.EntityFrameworkCore.ToolsNuGet package is installed.Project's target framework is at least
netcoreapp3.1.
dotnet ef tools installed globally are not working from the terminal
If you see the following message:
Make sure that .dotnet/tools folder is included in the PATH environment variable. For more information, see this troubleshooting guide.
On Windows, you can also run the .NET SDK installer with the 'Repair' option.
Cannot use 'update database', 'add migration', or other commands on Linux or macOS
Symptoms
Command not found or No such file or directory errors when using visual interface for EF Core, especially when Rider is installed as a Snap package.
Underlying problem
When launched from a Linux desktop, Rider may not load the environment variables set in your terminal configuration, which prevents it from finding the dotnet executable and the dotnet-ef global tool, causing the failure in the visual interface even when the commands work correctly in a standalone terminal.
Solution
Make sure that your system meets the prerequisites.
Add the following line to your user profile file that gets loaded for your graphical session. On most Linux distributions and macOS, it is
~/.profile, but other shells may use different configuration files, such as~/.bashrcfor Bash and~/.zshrcfor Zsh. If the file exists, add the line to the end of that file, otherwise, create the file.export PATH="$HOME/.dotnet:$HOME/.dotnet/tools:$PATH"Adding this line to your profile will allow the terminal and applications that inherit its environment to access .NET SDK and its tools.
Log out of your session and log back in or restart your computer for the changes to take effect.
Verify the
PATHin Rider by opening the IDE Scripting Console. Press Ctrl+Shift+A and search for 'IDE Scripting Console', and run:System.getenv("PATH");You should see that
/home/username/.dotnetand/home/username/.dotnet/toolsappear in the path.