.NET 6 and M1 problems when other SDKs are present in the system

If you have M1 Apple device and both .NET 6 and .NET 5 (or .NET Core 3.1) SDKs installed on it, it means that there is dotnet executable from .NET 6, and older SDKs shoved into x64 directory, see more details here. It leads to the following error:

Failed to load A, error: dlopen(/usr/local/share/dotnet/host/fxr/6.0.0/libhostfxr.dylib, 0x0001): tried: '/usr/local/share/dotnet/host/fxr/6.0.0/libhostfxr.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/libhostfxr.dylib' (no such file), '/usr/lib/libhostfxr.dylib' (no such file)
The library libhostfxr.dylib was found, but loading it from /usr/local/share/dotnet/host/fxr/6.0.0/libhostfxr.dylib failed
- Installing .NET Core prerequisites might help resolve this problem.
https://go.microsoft.com/fwlink/?linkid=2063366

At the current moment, the workaround is (as per the following issue):

  1. Remove all 5.X (and below) .NET SDK's;
  2. Download and install them again from https://dotnet.microsoft.com/en-us/download/dotnet;
  3. Run Rider, go to File | Settings | Build, Execution, Deployment | Toolset and Build and choose proper dotnet CLI (x64 or ARM depends on which one you need right now).

Details and the latest status can be found in the following YT issue: RIDER-71303.

13 out of 17 found this helpful
2 comments

Olga Diakonova Does .NET Core 3.1 and .NET 5 development work on M1 Macs? Am I able to open these "old" projects in Rider and build + debug them? The situation is quite unclear. I know only that .NET 6 is supported.

0

.NET Core 3.1 development on M1 with Rider is totally smooth.
What the issue describes is at the moment you have to configure dotnet CLI (x64 or ARM) per solution. In a solution that is configured for dotnetx64, no project may target net 6. So:

<TargetFrameworks>netstandard2.1;net6.0</TargetFrameworks>

Fails with:

  Microsoft.Common.CurrentVersion.targets(1177, 5): [MSB3971] The reference assemblies for ".NETFramework,Version=v6.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.

Which is understandable, but pain when you are migrating a really large solution from 3.1 to 6.

1

Please sign in to leave a comment.

Have more questions?

Submit a request