2

I'm working on an api in .net core 5 in wsl2 and I followed all the documentation to install the entity framework core tools.

when i run

dotnet tool list -g

it prints

Package Id      Version      Commands
--------------------------------------
dotnet-ef       5.0.7        dotnet-ef

but when i run

dotnet ef

or any of its child commands, I get this

Could not execute because 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.

now, i've looked in my path and it looks like when i ran

dotnet tool install --global dotnet-ef

it installed it under my C drive instead of inside wsl2 which I think might be the problem but I don't understand why running that within ubuntu would install it into my windows directories but this is the line from my path

/mnt/c/Users/ethan/.dotnet/tools

so i guess my question is, is the issue that it unstalled under my windows directories and if so how do i either force it to install on ububtu or change my path and if not what is happening.

Bird Dad
  • 317
  • 1
  • 5
  • 14

1 Answers1

7

i found this post: Cannot find command 'dotnet ef'

and running

export PATH="$PATH:$HOME/.dotnet/tools/"

makes dotnet ef work until i start a new terminal session so i wanted to double check the right way to make this a permanent fix, according to this article i found https://astrobiomike.github.io/unix/modifying_your_path the best way to handle it is just to add it to your bash_profile or zshrc so thats what i did

Bird Dad
  • 317
  • 1
  • 5
  • 14