我已经从以下链接安装了 dotnet SDK:
SDK版本:
$ dotnet --list-sdks
7.0.306 [/var/lib/snapd/snap/dotnet-sdk/216/sdk]
运行上面的代码后,我无法安装“dotnet-sdk”和“aspnet-runtime” 所以我通过 snapcraft 安装了它们:
Dotnet 核心 SDK:
sudo snap install dotnet-sdk --classic
Dotnet 运行时:
sudo snap install dotnet-runtime-70
我已经运行以下命令来测试它,但它给出了错误:
$ dotnet watch
错误:
dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
💡 Press "Ctrl + R" to restart.
dotnet watch 🔧 Building...
Determining projects to restore...
All projects are up-to-date for restore.
CSC : warning CS9057: The analyzer assembly '/usr/share/dotnet/sdk/7.0.400/Sdks/Microsoft.NET.Sdk.Razor/source-generators/Microsoft.NET.Sdk.Razor.SourceGenerators.dll' references version '4.7.0.0' of the compiler, which is newer than the currently running version '4.6.0.0'. [/home/admin/BlazorTest/BlazorTest.csproj]
You must install or update .NET to run this application.
App: /usr/share/dotnet/sdk/7.0.400/Sdks/Microsoft.NET.Sdk.Razor/tools/rzc.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '7.0.10' (x64)
.NET location: /var/lib/snapd/snap/dotnet-sdk/216/
The following frameworks were found:
7.0.9 at [/var/lib/snapd/snap/dotnet-sdk/216/shared/Microsoft.NETCore.App]
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.10&arch=x64&rid=manjaro-x64
/usr/share/dotnet/sdk/7.0.400/Sdks/Microsoft.NET.Sdk.Razor/targets/Microsoft.NET.Sdk.Razor.ScopedCss.targets(170,3): error : rzc rewritecss exited with code 150. [/home/admin/BlazorTest/BlazorTest.csproj]
dotnet watch ⏳ Waiting for a file to change before restarting dotnet...
您可以尝试安装Microsoft.AspNetCore.App,因为它指的是必须安装的框架。
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/metapackage-app?view=aspnetcore-7.0
按照“要安装缺少的框架,下载:”下载链接
https://dotnet.microsoft.com/en-us/download/dotnet/7.0/runtime?cid=getdotnetcore&arch=x64
另请参阅以下与解决“错误:rzc rewritecss exited with code 150”相关的堆栈溢出帖子