I have installed the latest version of the .net core using pacman on an Arch Linux:
sudo pacman -S dotnet-sdk
Running dotnet --info
shows the correct version:
Host (useful for support):
Version: 2.1.0
Commit: caa7b7e2ba
.NET Core SDKs installed:
2.1.0 [/opt/dotnet/sdk]
2.1.300 [/opt/dotnet/sdk]
I can run console applications, but when I run dotnet run
in an ASP.NET Core directory return this error:
It was not possible to find any compatible framework version The specified framework 'Microsoft.AspNetCore.App', version '2.1.0' was not found.
Why though versions seem to match, it doesn't run?
More details:
ls /opt/dotnet/sdk/
returns:
2.1.300 NuGetFallbackFolder
Contents of the .csproj
file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>
This question is old, but in case someone's trying to get .NET 5 to run on Arch, this can give you another solution.
If you build, publish and run the project specifying the platform runtime, dotnet
will build a self-contained application, with all necessary platform specific dependencies.
You can do that with the --runtime
/-r
flag.
Examples for Arch:
dotnet build -r linux-x64
dotnet run -r linux-x64
dotnet publish -r linux-x64
Refer to Microsoft docs for the available runtime identifiers: https://learn.microsoft.com/en-us/dotnet/core/rid-catalog
Edit:
I've also had less problems with paths using the AUR package instead of Snap's:
https://aur.archlinux.org/packages/dotnet-sdk-bin/
Edit 2:
After installing AUR's aspnet-runtime-bin
package, all errors about Microsoft.AspNetCore.App
not being found disappeared, without using the --runtime
flag:
https://aur.archlinux.org/packages/aspnet-runtime-bin