Background
I have installed the .NET framework on Arch GNU/Linux following the ArchWiki guide.
The main packages were:
dotnet-runtime
to run .NET managed applicationsdotnet-sdk
to build apps with .NET
Furthermore, I added ~/.dotnet/tools
to PATH
so that I can use dotnet tools from shell. I've done so by adding
export PATH="$PATH:/home/MyUserName/.dotnet/tools"
to my ~/.zshenv
file.
Problem
Everything worked fine, and I was able to build a few console apps. However, when I tried to build an ASP.NET Core Web App, I encountered some problems.
First, I created a new Web App by running:
dotnet new webapp -n MyAppsName --framework net6.0
When I try to build and run, I get the following error:
Building...
You must install or update .NET to run this application.
App: /home/MyUserName/RestOfThePath/MyAppsName/bin/Debug/net6.0/MyAppsName
Architecture: x64
Framework: 'Microsoft.AspNetCore.App', version '6.0.0' (x64)
.NET location: /usr/share/dotnet
No frameworks were found.
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=6.0.0&arch=x64&rid=arch-x64
It seems that the framework (or the appropriate version) is missing. However, when I run dotnet --info
, it does not seem that anything I need is missing. Below is the output of the previous command.
.NET SDK (reflecting any global.json):
Version: 6.0.109
Commit: 58a93139d8
Runtime Environment:
OS Name: arch
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /usr/share/dotnet/sdk/6.0.109/
global.json file:
Not found
Host:
Version: 6.0.9
Architecture: x64
Commit: 163a63591c
.NET SDKs installed:
6.0.109 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.NETCore.App 6.0.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Download .NET:
https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info
What am I missing? Any help would be appreciated.
P.S. Here is the official Microsoft's article intended to help troubleshoot this particular issue. It did not provide any new insight.
CodePudding user response:
.Net (note, as of .Net 5 it's just called ".Net", not ".Net Core" or ".Net Framework") is distributed in three different packages.
The one you're missing is aspnet-runtime
.
dotnet-sdk
lets you compile source code. dotnet-runtime
lets you run basic applications. aspnet-runtime
comes with a lot of extra stuff specific for ASP.Net, so it's distributed separately.
NORMALLY (such as on Windows), when you install the .Net Sdk, it also installs the ASP.Net runtime. It seems that on Arch the SDK package doesn't depend on aspnet-runtime
.
Once you install the aspnet-runtime
and run dotnet --info
again, you'll see under the ".NET runtimes installed" section an entry for "Microsoft.NETCore.App" (what dotnet-runtime
provides) and Microsoft.AspNetCore.App (what aspnet-runtime
provides).