JetBrains / rider-efcore

Entity Framework Core UI plugin for JetBrains Rider
https://plugins.jetbrains.com/plugin/18147-entity-framework-core-ui
MIT License
174 stars 13 forks source link

Cannot use update database or add migration. #215

Open atilao4501 opened 5 months ago

atilao4501 commented 5 months ago

Hi, i just started to learn .NET and this is my first project. I use JetBrains Rider on linux (Mint) and i was trying to create migrations and update my database using the efcore, but it doesnt work, it says that cant find the dotnet ef. But when i run on my terminal it works.

image

translation:

`/home/atila/.dotnet/dotnet ef database update --project GeekShopping.ProductApi/GeekShopping.ProductApi.csproj --startup-project GeekShopping.ProductApi/GeekShopping.ProductApi.csproj --context GeekShopping.ProductApi.Model.Context.MySqlContext --configuration Debug 20240221142417_AddProductDataTableOnDb

The specified command or file was not found.

Possible reasons for this include:

Process finished with exit code 1. `

and thats my PATH: image

seclerp commented 5 months ago

Hi @atilao4501, I can't tell for sure but seems like your shell configuration that Rider uses has the incorrect dotnet tools location.

Please try to troubleshoot the problem using this guide. This is probably not a plugin issue.

Also please check which shell is used in Settings | Tools | Terminal. It may be different from Zsh.

atilao4501 commented 5 months ago

Rider is using Zsh image

and the dotnet CLI path is correct too: image

i Can use dotnet ef from zsh : image

but i still cant use in EF CORE.

mierzvoj commented 5 months ago

I have identical issue.

seclerp commented 5 months ago

Could you folks try to configure .bashrc the same way you configured .zshrc? It may help as a workaround while fix is coming.

atilao4501 commented 5 months ago

Tried it and it doesnt work either: thats my .bashrc image

changed the rider terminal to bash: image

and it doesnt work, PS: it does work when i run on a external bash terminal.

seclerp commented 5 months ago

Did you tried restarting Rider after changing .bashrc?

atilao4501 commented 5 months ago

yes sir.

seclerp commented 5 months ago

From which environment do you start Rider? Is it from a superuser or your regular one? It would be great if you share your launcher configuration if it's possible and presented.

atilao4501 commented 5 months ago

i open it using my regular user and i installed it using snap:

image

env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/rider_rider.desktop /snap/bin/rider %f image

for translation, it can read and write.

seclerp commented 5 months ago

Please try to find the "IDE Scripting Console" in Search Everywhere (Shift, Shift), then type there System.getenv("PATH") and press Ctrl + Enter. This should dump your $PATH variable used while running Rider. Please check if there is a .tools folder entry from your .zshrc.

mierzvoj commented 5 months ago

mine image Screenshot 2024-02-28 at 15 08 30

seclerp commented 5 months ago

Please follow the instructions from https://www.jetbrains.com/help/idea/ide-scripting-console.html

mierzvoj commented 5 months ago

System.getenv("PATH") [0 ms]=> /usr/bin:/bin:/usr/sbin:/sbin

seclerp commented 5 months ago

It means that your user profile environment differs from the one you use in the external terminal and in the terminal tool window inside Rider (it works there because we spawn a new terminal session using a dedicated login shell).

So the only way to solve this issue correctly is to launch Rider from the same environment as your normal user profile-based terminal work.

mierzvoj commented 5 months ago

open -a Rider in console and EF tool works: image

mierzvoj commented 5 months ago

thank you

atilao4501 commented 3 months ago

System.getenv("PATH") [410 ms]=> /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

thats mine, still doesnt work.

Tried this but didnt work: open -a Rider in console and EF tool works:

dex91 commented 1 week ago

Hello everybody,

first at all, rider updates the .profile file when you install the ef-tools with rider.

Not only rider needs a restart, you need to log out and log in again to make the changes take any effect. To be sure just restart your entire system.

There are no other action needed like modifying the shortcut or starting rider from the shell.

Please read this before modifying .bashrc.

Here some screenshots... image

image