You must install or update .net to run this application
I kept getting his error after installing the required version of dotnet. Here's how I solved it: set user environment viriable DOTNET_ROOT to C:\Program Files\dotnet.
How I located the cause:
When I run dotnet --info in powershell, it printed these:
Host:
Version: 9.0.9
Architecture: x64
Commit: 893c2ebbd4
RID: win-x64
.NET SDKs installed:
No SDKs were found.
.NET runtimes installed:
Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
DOTNET_ROOT [C:\Users\myusername\Tools\dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/downloadThe DOTNET_ROOT was wrong.
So I opened DOTNET_ROOT, C:\Users\myusername\Tools\dotnet, this folder stored version 8, no wonder it kept asking me to update no matter how many times I've updated it.
The solution is:
- Press Win + E to open File Explorer.
- Right-click on This PC option on the left and select Properties.
- Scroll down to the Related settings section and then click the Advanced system settings option.
- Click the Environment Variables button.
Make sure the value of variable DOTNET_ROOT is C:\Program Files\dotnet, and make sure there is no other dotnet path in Path, check them in both user and system variables.
Reference
文章目录
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
FLY2X