Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force Xamarin to use Mono on Windows

I'm confused as to whether my Xamarin project is using the Mono framework or the MS .Net one.

If I create a simple console style app using this code to detect if running in Mono but says I'm not.

using System;

namespace ConsoleTest
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            Type t = Type.GetType("Mono.Runtime");
            if (t != null)
                Console.WriteLine("You are running with the Mono VM");
            else
                Console.WriteLine("You are running something else");
            Console.ReadLine();
        }
    }
}

The same code running in Xamarin on Mac OSX does say it's running under Mono.

Back on Windows, under my project settings -> Build -> General -> Target Framework is set to "Mono / .NET 4.0". I don't understand, does this mean it will use either Mono or .NET 4.0?

I want to force it to use the Mono framework!

like image 357
CodeAndCats Avatar asked Oct 21 '22 00:10

CodeAndCats


1 Answers

On windows by default XS uses the .NET run time but if you have installed mono framework you can set the default run time to "Mono" and again check output of you code.

You can set default run time to mono from here: On windows => Xamarin Studio => Tools => Options => Projects and .NETRuntimes"

like image 129
Ram Ch. Bachkheti Avatar answered Oct 27 '22 09:10

Ram Ch. Bachkheti