Mono on MacOSX - quot;The runtime version supported by this application is unavailable.quot; v4.5(MacOSX 上的 Mono -“此应用程序支持的运行时版本不可用.v4.5)
问题描述
我刚刚在 MACOSX 10.10.5 Yosemite 上安装了 Mono v4.0.4.安装程序包是: MonoFramework-MDK-4.0.4.4.macos10.xamarin.x86.pkg
从
System.Web.Compilation.CompilationExceptionCS0234:名称空间System.Web"中不存在类型或名称空间名称Http".您是否缺少程序集参考?
但是在/Library/Frameworks/Mono.framework/Versions/4.0.4/lib/mono/4.5 ,我可以看到
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.我对吗?
我在做一些基本的错误.有人可以指导我吗?
mono --runtime=
该选项是控制 CLR 运行时:
CLR 版本 .NET 版本1.0 1.01.1 1.12.0 2.0, 3.0, 3.54 4, 4.5, 4.6
如果您禁用 xsp4.exe,您会发现它需要一个可以提供 CLR 4.0 运行时的主机:
ikdasm xsp4.exe |头-n 2//元数据版本:v4.0.30319
或通过 xCorFlags:
>>corflags xsp4.exeMono/.NET Framework CorFlags 转换工具.版本 1.0.5643.36015版权所有 (c) SushiHangover.版权所有.版本:v4.0.30319CLR 标头:2.5聚乙烯:PE32CorFlags:0x9仅 : 132 位请求:032BITPREF:0签名:1
Mono 将通过探测它正在加载的 CIL 自动检测所需的运行时,因此无需指定它,除非您确实需要强制使用不同的运行时版本.
仅供参考:Mono 为 xsp4(和其他)的工具/实用程序安装 shell 脚本,因此您不必手动输入路径:
cat `which xsp4`#!/bin/shexec/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" "$@"
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.
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
I get this output:
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"?
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
Does this NOT indicate that v4.5 of the runtime is available?
Inside the 4.5 directory, I see lots of DLLs, all symlinked to a gac directory. The targets of these symlinks exist.
I can't figure out how to tell mono, YEAH, v4.5 DOES EXIST. USE IT.
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?
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
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=
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
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
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 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.
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MacOSX 上的 Mono -“此应用程序支持的运行时版本不可用."v4.5
- C# 中多线程网络服务器的模式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 输入按键事件处理程序 2022-01-01