Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make dotnet globally accessible in windows powershell?

I've installed .NET Core SDK on Windows 10 machine using dotnet-install scripts with the powershell command

./dotnet-install.ps1 -Channel Current

SDK was installed to default location C:\Users\[USERNAME]\AppData\Local\Microsoft\dotnet and the only way I can use it from another location is

C:\Users\[USERNAME]\AppData\Local\Microsoft\dotnet\dotnet.exe

How to make it global to use just dotnet anywhere?

like image 833
Aluminium Avatar asked Sep 16 '25 16:09

Aluminium


1 Answers

When you install it via scripts use key -InstallDir for change directory. To use exe file from everywhere just change Environment variable (add path to exe). For add it to your user PS profile:

Add-Content -Path $Profile.CurrentUserAllHosts -Value '$Env:Path += ";C:\Users\[USERNAME]\AppData\Local\Microsoft\dotnet\dotnet.exe"'
like image 85
Vad Avatar answered Sep 18 '25 07:09

Vad