Ahmed Hassan
Ahmed Hassan

Reputation: 47

I am installing .NET Core on Manjaro but its not working

I have installed the dotnet SDK from the following link:

  1. wget https://dot.net/v1/dotnet-install.sh
  2. chmod +x dotnet-install.sh
  3. sudo ./dotnet-install.sh --install-dir /usr/share/dotnet -channel Current -version latest

Sdk Version:

$ dotnet --list-sdks
7.0.306 [/var/lib/snapd/snap/dotnet-sdk/216/sdk]

After running the above code, I couldn't install "dotnet-sdk" and "aspnet-runtime" so I installed them via snapcraft:

Dotnet Core SDK:

sudo snap install dotnet-sdk --classic

Dotnet Runtime:

sudo snap install dotnet-runtime-70

I have run the following command to test it but it gives an error:

$ dotnet watch

Error:

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...

Upvotes: 0

Views: 769

Answers (2)

Panagiotis Kanavos
Panagiotis Kanavos

Reputation: 131706

The warning is saying that the project is using a newer SDK version than the one installed on the machine. The SDK isn't broken and trying to reinstall it with a different way will only cause errors. The very fact dotnet --list-sdks runs, means the SDK and the runtime are properly installed.

The latest .NET (Core) 7 SDK version in September 1, 2023 is 7.0.10. The error says

  The following frameworks were found:
    7.0.9 at [/var/lib/snapd/snap/dotnet-sdk/216/shared/Microsoft.NETCore.App]

One way to remove the warning is to install the latest SDK. Another one is to make the project target an earlier version, by creating a global.json in the root folder to target 7.0.306, the SDK version corresponding to the .NET 7.0.9 runtime. Yes, numbering is a mess:

{
  "sdk": {
    "version": "7.0.306"
  }
}

You can also specify that either 7.0.9 or any later version should be used :

{
  "sdk": {
    "version": "7.0.306",
    "rollForward": "latestFeature"
  }
}

Upvotes: 0

AneSwart
AneSwart

Reputation: 1

You could try to install the Microsoft.AspNetCore.App as it refers to the framework having to be installed.

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/metapackage-app?view=aspnetcore-7.0

Download link as per "To install missing framework, download:"

https://dotnet.microsoft.com/en-us/download/dotnet/7.0/runtime?cid=getdotnetcore&arch=x64

Also refer to the following stack overflow post related to resolving "error : rzc rewritecss exited with code 150"

How to resolve "error : rzc discover exited with code 150"

Upvotes: -1

Related Questions