Saber
Saber

Reputation: 2648

asp.net core 2.1 on arch linux does not run

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>

Upvotes: 3

Views: 3781

Answers (7)

Atheris
Atheris

Reputation: 105

Just install these:

sudo pacman -S dotnet-sdk aspnet-runtime

Upvotes: 0

Jo&#227;o Neves
Jo&#227;o Neves

Reputation: 53

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


Upvotes: 2

Saber
Saber

Reputation: 2648

Upgrading all the packages solved the problem:

pacman -Syu

It includes the dotnet-sdk package 2.1.300-2 updated on 2018-06-12 11:24 UTC: https://www.archlinux.org/packages/community/any/dotnet-sdk/

Upvotes: 0

wolfhoundjesse
wolfhoundjesse

Reputation: 1133

I had a similar issue trying to get global tools installed. Creating a symlink worked for me:

ln -s /opt/dotnet/ /usr/share/dotnet

Upvotes: 0

andrzej1_1
andrzej1_1

Reputation: 1193

@tura08 answer is wrong, because .NET Core should work on Arch Linux like on every other Linux system.

I was experiencing same issue so I just reported it https://github.com/dotnet/core-setup/issues/4216 and it seems dotnet-sdk package is missing aspnetcore-runtime-2.1 dependency. I wrote email to maintainer, so I hope he will fix package soon.

Upvotes: 1

marcusturewicz
marcusturewicz

Reputation: 2494

.NET Core is not currently supported on Arch, so there's no guarantees that it will work at all. Currently the following distros are supported on 64-bit:

  • Red Hat Enterprise Linux 7, 6
  • CentOS 7
  • Oracle Linux 7
  • Fedora 27
  • Debian 9, 8.7 or later versions
  • Ubuntu 18.04, 17.10, 16.04, 14.04
  • Linux Mint 18, 17
  • openSUSE 42.3 or later versions
  • SUSE Enterprise Linux (SLES) 12 Service Pack 2 or later
  • Alpine Linux 3.7 or later versions

See this page for more info.

You can see these issues related to Arch in the dotnet repos:

https://github.com/dotnet/coreclr/issues/4409

https://github.com/dotnet/corefx/issues/19447

https://github.com/dotnet/core-setup/issues/3845

Upvotes: 2

MUG4N
MUG4N

Reputation: 19717

I don't have a proper solution for your problem but maybe a workaround. I am using elementary os and .net core 2.1 works just fine, but I noticed that my path to the metapackages is different from yours:

.NET Core SDK (reflecting any global.json):
 Version:   2.1.300
 Commit:    adab45bf0c

Runtime Environment:
 OS Name:     elementary
 OS Version:  0.4.1
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.300/

Host (useful for support):
  Version: 2.1.0
  Commit:  caa7b7e2ba

.NET Core SDKs installed:
  2.0.0 [/usr/share/dotnet/sdk]
  2.1.300 [/usr/share/dotnet/sdk]

You could try to copy the metapackages from your installation folder /opt/dotnet/shared to /usr/share/dotnet/shared

This guy over here has a similar problem using Fedora: https://github.com/dotnet/core-setup/issues/4022

Upvotes: 1

Related Questions