1
votes

I would like to create Xamarin.Forms project using JetBrains Rider on Linux (Ubuntu 16 LTS).

I know, that Xamarin has no support for Linux, but JetBrains says that it is possible to develop Xamarin app on Linux using Rider.

So after installing dotnet SDK for Linux, I wanted to create Xamarin.Forms project, as you can see on the picture below (Screenshot of Rider), platform I choosed is Multiplatform, type is Xamarin.Forms and shared code is Portable Class Library.

Screenshot of Rider

I get an error "No target frameworks were found on this machine" and "No portable profiles were found on this machine".

If I choose platform iOS/macOS/tvOS/watchOS, it will create project without problems, I have problem only when creating Android or Multiplatform project.

1
"JetBrains says that it is possible to develop Xamarin app on Linux using Rider." I don't think JetBrains would have that kind of a claim. If they do want to support that they have to invest much more efforts than they should.Lex Li

1 Answers

1
votes

1.) make sure you have you installed the regular mono from HERE: http://www.mono-project.com/download/

2.) download xamarin-android/xamarin.android-oss_<version>.orig.tar.bz2 from HERE: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android-linux/lastSuccessfulBuild/Azure/

3.) unpack to, say, /usr/lib/xamarin.android-oss_<version>/

4.) Do this:

cd /path/to/xamarin.android-oss*/
sudo cp -r bin/Debug/lib/xamarin.android/* /usr/lib/mono
sudo mkdir -p /usr/lib/mono/xamarin-android/bin/
sudo cp -r bin/Debug/bin/* /usr/lib/mono/xamarin-android/bin/

5.) Create a Xamarin project (I used JetBrains Rider)

6.) Add this property-group to your .csproj file:

<PropertyGroup Condition=" '$(OS)' == 'Unix' ">
    <MonoAndroidBinDirectory>/usr/lib/mono/xamarin-android/bin</MonoAndroidBinDirectory>
    <AndroidSdkDirectory>$(ANDROID_SDK_PATH)</AndroidSdkDirectory>
    <AndroidNdkDirectory>$(ANDROID_NDK_PATH)</AndroidNdkDirectory>

    <TargetFrameworkRootPath>/usr/lib/mono/xbuild-frameworks/</TargetFrameworkRootPath>
</PropertyGroup>

7.) Make sure your ANDROID_SDK_PATH and ANDROID_NDK_PATH environment variables are set correctly.

Worked for me.

REFERENCE: https://github.com/0xFireball/xamarin-android-linux/blob/master/rider-setup.md