在MacOSX上为Mono-“此应用程序支持的运行时版本不可用." v4.5 [英] Mono on MacOSX - "The runtime version supported by this application is unavailable." v4.5

查看:587
本文介绍了在MacOSX上为Mono-“此应用程序支持的运行时版本不可用." v4.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在MACOSX 10.10.5 Yosemite上安装了Mono v4.0.4. 安装程序包是:MonoFramework-MDK-4.0.4.4.macos10.xamarin.x86.pkg http://www.mono-project.com/download下载/昨晚.

I have just installed Mono v4.0.4 on MACOSX 10.10.5 Yosemite. The installer package was: MonoFramework-MDK-4.0.4.4.macos10.xamarin.x86.pkg downloaded from http://www.mono-project.com/download/ last night.

我有一个想与xsp4.exe一起运行的webapi应用程序.我使用以下命令行:

I have a webapi app that I would like to run with xsp4.exe. I use this command line:

/usr/bin/mono --runtime=v4.5 /Library/Frameworks/Mono.framework/Versions/4.0.4/lib/mono/4.5/xsp4.exe

我得到以下输出:

WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
...

为什么会收到此消息?为什么说运行时版本不可用"?

Why do I get this message? Why does it say, "the runtime version is unavailable"?

我相信我已经安装了v4.5,以及单声道v4.0.4.在目录/Library/Frameworks/Mono.framework/Versions/4.0.4/lib/mono中,我可以看到

I believe I have v4.5 installed, with mono v4.0.4. In the directory /Library/Frameworks/Mono.framework/Versions/4.0.4/lib/mono, I can see

  • 2.0
  • 3.5
  • 4.0
  • 4.5

这是否表明运行时v4.5可用?

Does this NOT indicate that v4.5 of the runtime is available?

在4.5目录中,我看到了很多DLL,它们都符号链接到gac目录.这些符号链接的目标存在.

Inside the 4.5 directory, I see lots of DLLs, all symlinked to a gac directory. The targets of these symlinks exist.

我不知道如何分辨单声道 YEAH,v4.5是否存在.使用它.

I can't figure out how to tell mono, YEAH, v4.5 DOES EXIST. USE IT.

我有一个单独的,可能是相关的问题. 收到上述警告后,xsp4运行.当我尝试在浏览器中加载ASPX应用程序时,出现了可怕的CS0234错误,

I have a separate, probably related problem. After getting the above warning, xsp4 runs. When I try to load the ASPX app in the browser, I get the dreaded CS0234 error,

System.Web.Compilation.CompilationException
CS0234: The type or namespace name `Http' does not exist in the namespace `System.Web'. Are you missing an assembly reference?

但是在/Library/Frameworks/Mono.framework/Versions/4.0.4/lib/mono/4.5中,我可以看到

But in /Library/Frameworks/Mono.framework/Versions/4.0.4/lib/mono/4.5 , I can see

System.Web.Http.dll -> ../gac/System.Web.Http/4.0.0.0__31bf3856ad364e35/System.Web.Http.dll

该DLL肯定在gac目录中存在.我认为xsp4/mono无法找到属于v4.5的System.Web.Http.dll.我对吗?

And that DLL sure does exist in the gac directory. I think xsp4/mono cannot find the System.Web.Http.dll which is part of v4.5. Am I right?

我在做一些基本的错误.有人可以引导我正确吗?

I am doing something basic wrong. Can someone steer me right?

推荐答案

mono --runtime=

该选项是控制 CLR 运行时的方法:

That option is to control the CLR runtime:

CLR version .NET version
1.0         1.0
1.1         1.1
2.0         2.0, 3.0, 3.5
4           4, 4.5, 4.6

如果您不使用xsp4.exe,将会看到它需要一个可以提供CLR 4.0运行时的主机:

If you disasm xsp4.exe you will see that it requires a host that can provide the CLR 4.0 runtime:

ikdasm xsp4.exe | head -n 2

// Metadata version: v4.0.30319

或通过xCorFlags:

Or via xCorFlags:

>>corflags xsp4.exe

Mono/.NET Framework CorFlags Conversion Tool.  Version  1.0.5643.36015
Copyright (c) SushiHangover.  All rights reserved.

Version   : v4.0.30319
CLR Header: 2.5
PE        : PE32
CorFlags  : 0x9
ILONLY    : 1
32BITREQ  : 0
32BITPREF : 0
Signed    : 1

Mono将通过探测正在加载的CIL来自动检测所需的运行时,因此除非您确实需要强制使用其他运行时版本,否则无需指定它.

Mono will auto-detect the runtime required by probing the CIL that it is loading, so there is no need to specify it unless you really need to force a different runtime version.

仅供参考:Mono为xsp4(及其他)的工具/实用程序安装了shell脚本,因此您无需手动输入路径:

FYI: Mono installs shell scripts for tools/utilities for xsp4 (and others) so you do not have to hand-type the paths:

cat `which xsp4`

#!/bin/sh
exec /Library/Frameworks/Mono.framework/Versions/4.2.1/bin/mono $MONO_OPTIONS "/Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5/xsp4.exe" "$@"

这篇关于在MacOSX上为Mono-“此应用程序支持的运行时版本不可用." v4.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆