Shaun Hevey
Fix Xamarin build error in JetBrains Rider with .NET 6 Preview installed
October 10, 2021
By Shaun Hevey

With the preview version of .NET 6 installed on my Mac, I started seeing this error in Jetbrains Rider while building a new Xamarin application.

The imported project "/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props" was not found. Confirm that the expression in the Import declaration "/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props" is correct and that the file exists on disk.  ...

It turns out the fix for this is to change the Use MSBuild version: setting in JetBrains rider. To find this setting, it is available in JetBrains Rider (menu) > Preferences > Build, Execution, Deployment > Toolset and Build

Menu item showing where preferences are located

Window showing rider preferences

Once you find the Toolset and Build windows, click the dropdown form Use MSBuild version: and select 15.0 /Library/Frameworks/Mono.framework ... so that it starts building your Xamarin application again with Mono.

Showing MSBuild option to choose

Then click save, you can choose to save it for only the current project, the current project but it shared with your team (through source control) or globally on your machine for every project. I would personally only choose one of the first two options as this setting could break other .NET applications that you want to develop within JetBrains rider.

Preferences save options

After I made this change and tried to build my Xamarin application, I received a different error requiring a NuGet restore (see error below).

Showing NuGet Restore error

To perform this action in JetBrains Rider, go up to the Tools (menu) > NuGet > NuGet restore.

Menu item where NuGet Restore option is

Once the restore is complete, you should now be able to build and run your Xamarin application in JetBrains Rider.