You are not logged in.

#1 2021-04-29 13:01:12

thaun
Member
Registered: 2021-04-29
Posts: 2

[SOLVED] dotnet has incorrect RID in dotnet --info

Apparently when you start of with "dotnet new console" and then it attempts to restore the packages, unfortunately that will fail cause the RID configured is incorrect, it is set to arch-x64, but it should be set to linux-x64, else the project is unable to find the packages.

It fails with this error:
error NU1101: Unable to find package Microsoft.NETCore.App.Host.arch-x64. No packages exist with this id in source(s): nuget.org

And this is my dotnet --info output:

.NET SDK (reflecting any global.json):
 Version:   5.0.202
 Commit:    db7cc87d51

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64 // <--- this should be linux-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.202/

Host (useful for support):
  Version: 5.0.0
  Commit:  cf258a14b7

.NET SDKs installed:
  3.1.114 [/usr/share/dotnet/sdk]
  5.0.202 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

The temporary fix that i've found out is to add the runtime identifier in csproj.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <RuntimeIdentifier>linux-x64</RuntimeIdentifier> <!--  This line is the temp fix  -->
  </PropertyGroup>

</Project>

If anyone has a permanent solution to this, i would be grateful.

dotnet sdk's were installed trough:
dotnet5: https://archlinux.org/packages/communit … otnet-sdk/
dotnet3.1: https://archlinux.org/packages/communit … t-sdk-3.1/

Last edited by thaun (2021-05-03 12:00:30)

Offline

#2 2021-05-02 00:47:14

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 916

Re: [SOLVED] dotnet has incorrect RID in dotnet --info

Strange, for me it works normally.

Here are the outputs:

~/test >> dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.202
 Commit:    db7cc87d51

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.202/

Host (useful for support):
  Version: 5.0.5
  Commit:  561d6ea60d

.NET SDKs installed:
  5.0.202 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
~/test >> dotnet new console
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /home/igor/test/test.csproj...
  Determining projects to restore...
  Restored /home/igor/test/test.csproj (in 113 ms).
Restore succeeded.

~/test >> dotnet run
Hello World!

Why do you have both 5.0 and 3.1 SDKs? 5.0 SDK can build previous versions (including 3.1), you only need 3.1 runtime. Maybe that's the issue?

These are all the packages I have installed:

~/test >> pacman -Qq | grep -E 'dotnet|standard|aspnet'
aspnet-runtime
aspnet-targeting-pack
dotnet-host
dotnet-runtime
dotnet-runtime-3.1
dotnet-sdk
dotnet-targeting-pack
netstandard-targeting-pack

Last edited by karabaja4 (2021-05-02 00:52:10)

Offline

#3 2021-05-03 05:56:02

thaun
Member
Registered: 2021-04-29
Posts: 2

Re: [SOLVED] dotnet has incorrect RID in dotnet --info

Ah yeah, looks like that might have been the problem for some reason. I've managed to fix the issue. I uninstalled all packages listed in the command you provided

~ pacman -Qq | grep -E 'dotnet|standard|aspnet'
aspnet-runtime
aspnet-runtime-3.1
aspnet-targeting-pack-bin
dotnet-host-bin
dotnet-runtime
dotnet-runtime-3.1
dotnet-sdk
dotnet-sdk-3.1
dotnet-targeting-pack-3.1
dotnet-targeting-pack-bin
netstandard-targeting-pack

And then i installed dotnet-sdk-bin from aur, reasons to do so was cause of this issue that i also had:
https://github.com/OmniSharp/omnisharp- … -830461256

And then after the install, it works, and i could now remove the RuntimeIdentifier from the csproj, which is cool.

Offline

Board footer

Powered by FluxBB