强制Xamarin在Windows上使用Mono

Cod*_*ats 5 windows mono xamarin

我很困惑我的Xamarin项目是使用Mono框架还是MS .Net.

如果我使用此代码创建一个简单的控制台样式应用程序来检测是否在Mono中运行但是我说不是.

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();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

在Mac OSX上运行Xamarin的相同代码确实说它在Mono下运行.

回到Windows,在我的项目设置 - >构建 - >常规 - >目标框架设置为"Mono/.NET 4.0".我不明白,这是否意味着它将使用Mono或.NET 4.0?

我想强迫它使用Mono框架!

Ram*_*eti 3

默认情况下,XS 在 Windows 上使用 .NET 运行时,但如果您安装了 Mono 框架,则可以将默认运行时设置为“Mono”,然后再次检查代码的输出。

您可以从此处将默认运行时间设置为单声道:在 Windows 上 => Xamarin Studio => 工具 => 选项 => 项目和 .NETRuntimes”