ubuntu 如何修复dotnet ef工具,.NET位置找不到

guz6ccqo  于 2022-12-29  发布在  .NET
关注(0)|答案(1)|浏览(445)

我用实体框架核心创建了一个.net core 7项目,嗯,当时我安装了.net core 6所以我的全局ef工具还是版本6,然后我更新到版本7,这里我有一个问题,它说我没有安装框架。2我决定卸载dotnet。3然后我重新安装了sdk7和globalef工具。4并且出现了新的错误。5我尝试重新安装了很多次。但还是这样,现在我不能用ef工具了。

This is dotnet --info

    .NET SDK:
 Version:   7.0.101
 Commit:    bb24aafa11

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.04
 OS Platform: Linux
 RID:         ubuntu.22.04-x64
 Base Path:   /usr/share/dotnet/sdk/7.0.101/

Host:
  Version:      7.0.1
  Architecture: x64
  Commit:       97203d38ba

.NET SDKs installed:
  7.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/lib/dotnet]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

这就是错误

You must install .NET to run this application.

App: /home/apriza/.dotnet/tools/dotnet-ef
Architecture: x64
App host version: 7.0.1
.NET location: Not found

Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.22.04-x64&apphost_version=7.0.1
zpgglvta

zpgglvta1#

我找到了答案,我将/usr/share/dotnet中的根dotnet env更改为dotnet 7。运行export DOTNET_ROOT=/usr/share/dotnet

相关问题