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

Cannot use update database or add migration. #215

Open
atilao4501 opened this issue Feb 27, 2024 · 19 comments
Open

Cannot use update database or add migration. #215

atilao4501 opened this issue Feb 27, 2024 · 19 comments
Labels
bug Something isn't working

Comments

@atilao4501
Copy link

atilao4501 commented Feb 27, 2024

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:

  • You misspelled a built-in dotnet command.
  • You intended to execute a .NET program, but dotnet-ef does not exist.
  • You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

Process finished with exit code 1.
`

and thats my PATH:
image

@atilao4501 atilao4501 added the bug Something isn't working label Feb 27, 2024
@seclerp
Copy link
Member

seclerp commented Feb 27, 2024

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
Copy link
Author

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
Copy link

I have identical issue.

@seclerp
Copy link
Member

seclerp commented Feb 27, 2024

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

@atilao4501
Copy link
Author

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
Copy link
Member

seclerp commented Feb 27, 2024

Did you tried restarting Rider after changing .bashrc?

@atilao4501
Copy link
Author

yes sir.

@seclerp
Copy link
Member

seclerp commented Feb 27, 2024

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
Copy link
Author

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
Copy link
Member

seclerp commented Feb 28, 2024

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
Copy link

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

@seclerp
Copy link
Member

seclerp commented Feb 28, 2024

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

@mierzvoj
Copy link

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

@seclerp
Copy link
Member

seclerp commented Feb 28, 2024

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.

@seclerp seclerp closed this as completed Feb 28, 2024
@seclerp seclerp reopened this Feb 28, 2024
@mierzvoj
Copy link

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

@mierzvoj
Copy link

thank you

@atilao4501
Copy link
Author

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
Copy link

dex91 commented Jul 28, 2024

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

@mysteryx93
Copy link

mysteryx93 commented Aug 16, 2024

I also have this problem. I added the path in ~/.profile

If I open a terminal (fish terminal, had to add it to PATH in a different way), echo $PATH displays it

If I open Rider, open the terminal, echo $PATH doesn't show it.

If I open Rider from the terminal, then it works.

Changing Rider terminal to fish doesn't help either.

One work-around is in Settings|Tools|Terminal, Environment Variables, copy the system value and add it in the custom variables zone with the new value. That's hacky but it works...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants