我不清楚我的 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();
}
}
}
在 Mac OSX 上的 Xamarin 中运行的相同代码确实表示它在 Mono 下运行。
回到 Windows,在我的项目设置下 -> 构建 -> 常规 -> 目标框架设置为“Mono/.NET 4.0”。我不明白,这是否意味着它将使用 Mono 或 .NET 4.0?
我想强制它使用Mono框架!
最佳答案
在 Windows 上,默认情况下 XS 使用 .NET 运行时,但如果您安装了单声道框架,您可以将默认运行时设置为“Mono”并再次检查代码的输出。
您可以从此处将默认运行时间设置为单声道: 在 Windows 上 => Xamarin Studio => 工具 => 选项 => 项目和 .NETRuntimes"
关于windows - 强制 Xamarin 在 Windows 上使用 Mono,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19041236/