C# 单声道如何工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/216841/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How does Mono work
提问by DavidG
I have used C# in Visual Studio with .NET, and I have played around a little with Mono on openSUSE Linux, but I don't really understand how it works.
我在带有 .NET 的 Visual Studio 中使用了 C#,并且在 openSUSE Linux 上使用了 Mono,但我并不真正了解它是如何工作的。
If I write an app in Windows on .NET, how does this relate to Mono? I can't just execute an a Windows .exe file on Linux without Wine, so it doesn't help me execute apps developed in Windows.
如果我在 .NET 上的 Windows 中编写应用程序,这与 Mono 有什么关系?我不能在没有 Wine 的情况下在 Linux 上执行 Windows .exe 文件,因此它不能帮助我执行在 Windows 中开发的应用程序。
Is the purpose purely to have a .NET library equivalent on Linux (and others) to make cross platform development easier? For example, if I was a business and wanted to reach Linux customers, but really wanted to use .NET, then Mono should be my choice? Or is there something more that I'm missing?
目的是否纯粹是为了在 Linux(和其他)上拥有一个等效的 .NET 库来简化跨平台开发?例如,如果我是一家企业,想要接触 Linux 客户,但真的想使用 .NET,那么 Mono 应该是我的选择吗?或者还有什么我想念的吗?
采纳答案by Michael Stum
A Windows EXE contains multiple "parts". Simplified, the .net Code (=MSIL) is only a Part of the EXE, and there is also a "real" native Windows Part inside the EXE that serves as some sort of launcher for the .net Framework which then executes the MSIL.
一个 Windows EXE 包含多个“部分”。简而言之,.net 代码 (=MSIL) 只是 EXE 的一部分,在 EXE 中还有一个“真正的”本机 Windows 部分,用作 .net 框架的某种启动器,然后执行 MSIL。
Mono will just take the MSIL and execute it, ignoring the native Windows Launcher stuff.
Mono 将只获取 MSIL 并执行它,而忽略本机 Windows Launcher 的内容。
Again, this is a simplified overview.
同样,这是一个简化的概述。
Edit:I fear my understanding of the deep deep details is not good enough for really much detail (I know roughly what a PE Header is, but not really the details), but i found these links helpful:
编辑:我担心我对深层细节的理解对于真正的细节来说还不够(我大致知道 PE Header 是什么,但不是真正的细节),但我发现这些链接很有帮助:
NET Assembly Structure – Part II
回答by Greg Hewgill
You can in fact run a .NET .exe file with Mono on Linux. This does not require Wine. In fact, Mono compiles programs to .exe files, which can run either with Mono on Linux or as an executable on Windows.
实际上,您可以在 Linux 上使用 Mono 运行 .NET .exe 文件。这不需要Wine。事实上,Mono 将程序编译为 .exe 文件,这些文件既可以在 Linux 上与 Mono 一起运行,也可以在 Windows 上作为可执行文件运行。
回答by Quantenmechaniker
Mono is an open-source implementation of Microsofts .NET CLR (Common Language Runtime). This is what runs part of .NET programs which are not in native code but in CIL (Common Intermediate Language), a language and machine-neutral intermediate language. The Runtime takes that intermediate code and translates it into machine code.
Mono 是 Microsoft .NET CLR(公共语言运行时)的开源实现。这是运行 .NET 程序的一部分,这些程序不是使用本机代码而是使用 CIL(通用中间语言),一种语言和机器中立的中间语言。运行时获取该中间代码并将其转换为机器代码。
At the current state of Mono, you can take .NET programs that use the main parts of .NET (mscorlib.dll) and run them everywhere Mono runs, not just Windows.
在 Mono 的当前状态下,您可以使用使用 .NET 主要部分 (mscorlib.dll) 的 .NET 程序并在 Mono 运行的任何地方运行它们,而不仅仅是 Windows。
回答by milot
But as it is mentioned that Mono is open source and you can't just rely that it will be the full .NET implementation, it has some controls that are not working, you must be also careful with P/Invokes that your application will use, for e.g your application will communicate with MCI (Multimedia Controller Interface) under win32. But I was using mono writing GTK# Applications also, but I've also used my Windows applications that worked without any recompilation as mentioned our fellow programmers above, that is, mono is an open source alternative of Microsoft's .NET, and by default if you are building either WinForms or Gtk# applications mono will compile and will create an .exe assembly for each file, and of course if you want it will create an Dynamic Link Library (DLL), almost as it is done in .NET. Just for suggestion try writing some Gtk# (with MonoDevelop IDE which has its built-in gui designer called stetic). And of course mono can be a great replacement for Web Services that you can create them on .NET and you can host them on Apache (because Linux hosting nowadays are more cheap than Windows ones) web services and other asp.net apps will work under apache with a mod_mono module that must be included in apache.
但正如前面提到的 Mono 是开源的,你不能仅仅依赖它是完整的 .NET 实现,它有一些无法工作的控件,你还必须小心你的应用程序将使用的 P/Invokes ,例如,您的应用程序将在 win32 下与 MCI(多媒体控制器接口)通信。但是我也在使用 mono 编写 GTK# 应用程序,但我也使用了我的 Windows 应用程序,这些应用程序无需任何重新编译即可运行,正如我们上面的程序员伙伴所提到的,也就是说,mono 是 Microsoft .NET 的开源替代品,并且默认情况下,如果您正在构建 WinForms 或 Gtk# 应用程序,mono 将编译并为每个文件创建一个 .exe 程序集,当然,如果您愿意,它将创建一个动态链接库 (DLL),几乎就像在 .NET 中所做的那样。仅供参考,尝试编写一些 Gtk#(使用 MonoDevelop IDE,它具有称为 stetic 的内置 gui 设计器)。当然,mono 可以很好地替代 Web 服务,您可以在 .NET 上创建它们,并且可以在 Apache 上托管它们(因为现在 Linux 托管比 Windows 托管更便宜)Web 服务和其他 asp.net 应用程序将在apache 必须包含在 apache 中的 mod_mono 模块。
A little bit out of topic but I just wanted to tell you a sneak-peek from my experience.
有点跑题,但我只是想告诉你我的经验先睹为快。
回答by milot
To further Michael's response, I believe you will have to recompile on Mono for the app to run on the Mono runtime. Exceptions may exist. I've only played around with Mono just a bit, and I've always re-compiled the source. I've never tried to run a .NET app directly on Mono.
为了进一步迈克尔的回应,我相信您必须在 Mono 上重新编译应用程序才能在 Mono 运行时上运行。可能存在异常。我只玩了一点 Mono,而且我总是重新编译源代码。我从未尝试过直接在 Mono 上运行 .NET 应用程序。
Also, Mono 1.9 is supposed to be fully .NET 2.0 compliant. Mono Olive and Moonlight are supposed to add .NET 3.0 (less WPF) and Silverlight functionality.
此外,Mono 1.9 应该完全符合 .NET 2.0。Mono Olive 和 Moonlight 应该添加 .NET 3.0(更少的 WPF)和 Silverlight 功能。
回答by jaircazarin-old-account
Also you can take a look to MoMA (if your goal is to port applications from Win to Lin).
您也可以查看 MoMA(如果您的目标是将应用程序从 Win 移植到 Lin)。
The Mono Migration Analyzer (MoMA) tool helps you identify issues you may have when porting your .Net application to Mono. It helps pinpoint platform specific calls (P/Invoke) and areas that are not yet supported by the Mono project.
Mono 迁移分析器 (MoMA) 工具可帮助您识别在将 .Net 应用程序移植到 Mono 时可能遇到的问题。它有助于查明特定于平台的调用 (P/Invoke) 和 Mono 项目尚不支持的区域。
Here is a webapp that compares the types of the BCL already implemented by Mono and the .NET Framework 3.5
这是一个 webapp,它比较了 Mono 和 .NET Framework 3.5 已经实现的 BCL 的类型
回答by Justin
This is an old question (with an already selected answer) but I do not believe the question has really been answered well.
这是一个老问题(已经选择了答案),但我认为这个问题并没有得到很好的回答。
First, a little background...
首先介绍一下背景...
How does .NET work?
.NET 如何工作?
A traditional Windows .EXE file is a binary file that represents a series of machine language instructions that your computer understands and that makes calls into the Win32 API which are parts of Windows that deliver services that applications can take advantage of. The machine language used is very specific to your kind of computer and the Win32 calls make the executable very dependent on Windows. A .NET executable is not like that.
传统的 Windows .EXE 文件是一个二进制文件,它表示您的计算机可以理解的一系列机器语言指令,并调用 Win32 API,Win32 API 是 Windows 的一部分,提供应用程序可以利用的服务。使用的机器语言非常特定于您的计算机类型,Win32 调用使可执行文件非常依赖于 Windows。.NET 可执行文件不是那样的。
It is important to realize that a .NET executable (.EXE file) is not actually a native Windows application. Windows itself does not understand how to run the code in a .NET executable. Your computer does not understand it either.
认识到 .NET 可执行文件(.EXE 文件)实际上并不是本机 Windows 应用程序,这一点很重要。Windows 本身不了解如何在 .NET 可执行文件中运行代码。你的电脑也不理解。
Much like Java, a .NET application is made up of instructions in a language called CIL (Common Intermediate Language) that you can think of as the machine language for an idealized computer that does not really exist. In .NET, the software implementation of this idealized machine is called the Common Language Runtime (CLR). The equivalent in the Java world is called the Java Virtual Machine (JVM). In Java, the equivalent to CIL is called Java bytecode. CIL is sometimes called MSIL (Microsoft Intermediate Language).
与 Java 非常相似,.NET 应用程序由一种称为 CIL(通用中间语言)的语言的指令组成,您可以将其视为实际上并不存在的理想化计算机的机器语言。在 .NET 中,这种理想化机器的软件实现称为公共语言运行时 (CLR)。Java 世界中的等价物称为 Java 虚拟机 (JVM)。在 Java 中,CIL 的等价物称为 Java 字节码。CIL 有时称为 MSIL(微软中级语言)。
CIL is designed to run on the CLR (an idealized machine) but is otherwise platform independent, which means that the CIL does not care what kind of computer you have or what operating system you are running.
CIL 被设计为在 CLR(理想化的机器)上运行,但在其他方面是独立于平台的,这意味着 CIL 不关心您拥有哪种类型的计算机或您正在运行什么操作系统。
Just as you need a native version of the Java JVM on each platform on which you want to run Java, you need a native version of the CLR to run .NET CIL executables. The CLR is a native Windows application just like the traditional Win32 EXE files described above. The CLR itself is specific to the Windows implementation and computer architecture on which it was designed to run.
正如在每个要运行 Java 的平台上都需要 Java JVM 的本机版本一样,您也需要 CLR 的本机版本来运行 .NET CIL 可执行文件。CLR 是本机 Windows 应用程序,就像上面描述的传统 Win32 EXE 文件一样。CLR 本身特定于它设计运行的 Windows 实现和计算机体系结构。
It does not matter what .NET language you start with (C#, VisualBasic, F#, IronPython, IronRuby, Boo, etc.), they all get compiled down to CIL bytecode. You can easily "disassemble" a CIL program into a form of object-oriented assembly language that is easily readable by humans. You can write a program in CIL directly yourself but few people do.
无论您使用哪种 .NET 语言(C#、VisualBasic、F#、IronPython、IronRuby、Boo 等),它们都会被编译为 CIL 字节码。您可以轻松地将 CIL 程序“反汇编”成一种人类易于阅读的面向对象的汇编语言形式。您可以自己直接用 CIL 编写程序,但很少有人这样做。
On Windows, the CLR compiles this CIL code Just-in-Time (JIT) right when you run the executable--just before the code is actually run. This means that the CIL bytecode is converted (compiled) to actual machine code that runs natively on your computer. This part of the CLR is called the JIT compiler or often just the JIT.
在 Windows 上,CLR 会在您运行可执行文件时即时编译此 CIL 代码(JIT)——就在代码实际运行之前。这意味着 CIL 字节码被转换(编译)为在您的计算机上本地运行的实际机器代码。CLR 的这部分称为 JIT 编译器或通常只是 JIT。
To date, Microsoft has released four versions of the CLR: 1.0, 1.1, 2.0, and 4.0. You need to have the right version of the CLR installed on your machine if you want to run .NET executables targeting that runtime. The CLR 2.0 supports .NET 2.0, 3.0, and 3.5 applications. For other versions of .NET, the .NET version maps cleanly to the CLR version.
迄今为止,微软已经发布了四个版本的 CLR:1.0、1.1、2.0 和 4.0。如果要运行面向该运行时的 .NET 可执行文件,则需要在计算机上安装正确版本的 CLR。CLR 2.0 支持 .NET 2.0、3.0 和 3.5 应用程序。对于其他版本的 .NET,.NET 版本完全映射到 CLR 版本。
In addition to the JIT/CLR, .NET provides a host of libraries (assemblies) that make up the rest of the .NET framework and that provide a host of capabilities and services that .NET applications can call upon. The great majority of these assemblies are pure CIL code which runs on the CLR. On Windows, a some make calls into the Win32 API as well. When you install .NET, you are installing the CLR, the class libraries (framework), and a bunch of development tools. Each version of the CLR generally requires a complete set of these "framework" assemblies. Some versions of .NET (eg. 3.0 and 3.5) added additional framework assemblies without updating the CLR or the existing assemblies associated with that CLR.
除了 JIT/CLR 之外,.NET 还提供了大量库(程序集),它们构成了 .NET 框架的其余部分,并提供了 .NET 应用程序可以调用的大量功能和服务。大多数这些程序集是在 CLR 上运行的纯 CIL 代码。在 Windows 上,一些也会调用 Win32 API。当您安装 .NET 时,您正在安装 CLR、类库(框架)和一堆开发工具。CLR 的每个版本通常都需要一套完整的这些“框架”程序集。.NET 的某些版本(例如 3.0 和 3.5)在不更新 CLR 或与该 CLR 关联的现有程序集的情况下添加了额外的框架程序集。
The Portable Executable (PE) file format that a Windows .EXE file is delivered in contains a header that describes the executable and identifies the file as a .NET file or a native Win32 file. When Windows tries to run a .NET file, it sees this header and automatically invokes the CLR on your behalf. This is why .NET EXE files appear to run natively on Windows.
交付 Windows .EXE 文件的可移植可执行 (PE) 文件格式包含一个标头,该标头描述可执行文件并将该文件标识为 .NET 文件或本机 Win32 文件。当 Windows 尝试运行 .NET 文件时,它会看到此标头并自动代表您调用 CLR。这就是 .NET EXE 文件似乎在 Windows 上本地运行的原因。
Ok, so how does Mono work?
好的,那么 Mono 是如何工作的?
Mono implements the CLR on Linux, Mac, and other platforms. The Mono runtime (the CLR) is a native application written mostly in the C language and compiled down to machine language code for the computer system on which is designed to run. Like on Windows, the Mono runtime is specific to the Operating System and kind of machine you are using.
Mono 在 Linux、Mac 和其他平台上实现了 CLR。Mono 运行时 (CLR) 是一个本机应用程序,主要用 C 语言编写,并编译为机器语言代码,用于设计运行的计算机系统。与 Windows 一样,Mono 运行时特定于操作系统和您使用的机器类型。
Just like on Windows, the Mono runtime (the CLR) compiles the CIL bytecode in your .NET executable Just-in-time to native code that your computer can understand and execute. In this way, a .NET file is just as "native" to Linux as it is to Windows.
就像在 Windows 上一样,Mono 运行时 (CLR) 将 .NET 可执行文件中的 CIL 字节码实时编译为您的计算机可以理解和执行的本机代码。通过这种方式,.NET 文件对 Linux 就像对 Windows 一样“本机”。
To port Mono to a new architecture you need to port the JIT/CLR. This is just like porting any native application to a new platform.
要将 Mono 移植到新架构,您需要移植 JIT/CLR。这就像将任何本机应用程序移植到新平台一样。
How well .NET code runs on Linux or Mac is really just a question of how well the CLR is implemented on these systems. In theory, the Mono CLR could execute .NET code on these systems much better than the MS version of .NET does on Windows. In practice, the MS implementation is generally superior (though not in all cases).
.NET 代码在 Linux 或 Mac 上的运行情况实际上只是 CLR 在这些系统上的实现情况的问题。理论上,Mono CLR 可以在这些系统上执行 .NET 代码,比 MS 版本的 .NET 在 Windows 上执行的要好得多。在实践中,MS 实现通常更胜一筹(尽管并非在所有情况下)。
In addition to the CLR, Mono provides most of the rest of the libraries (assemblies) that make up the .NET framework. Just as with the Microsoft version of .NET (in fact more so) the Mono assemblies are provided as CIL bytecode. This makes it possible to take a *.dll or *.exe file from Mono and run it unmodified on Windows, Mac, or Linux as CIL is the "native" language of the CLR implementations on these systems.
除了 CLR 之外,Mono 还提供了构成 .NET 框架的大部分其他库(程序集)。正如 Microsoft 版本的 .NET(实际上更多)一样,Mono 程序集以 CIL 字节码的形式提供。这使得可以从 Mono 获取 *.dll 或 *.exe 文件并在 Windows、Mac 或 Linux 上未经修改地运行它,因为 CIL 是这些系统上 CLR 实现的“本机”语言。
Just like on Windows, Mono supports multiple versions of the CLR and the associated assemblies:
就像在 Windows 上一样,Mono 支持多个版本的 CLR 和相关程序集:
Very early versions of Mono (before 1.2?) only supported CLR 1.0 or 1.1. Mono did not support big chunks of the 2.0 framework until it's own 2.0 version.
Mono 的早期版本(1.2 之前?)仅支持 CLR 1.0 或 1.1。Mono 直到它自己的 2.0 版本才支持 2.0 框架的大块。
Mono versions up to version 2.4 supported both CLR 1.1 and CLR 2.0 applications.
Mono 版本高达 2.4 版同时支持 CLR 1.1 和 CLR 2.0 应用程序。
Starting with Mono 2.6, CLR 4.0 was added but CLR 2.0 was still the default.
从 Mono 2.6 开始,添加了 CLR 4.0,但 CLR 2.0 仍然是默认的。
Starting with Mono 2.8 the CLR 4.0 became the default and the CLR 1.1 is no longer supported.
从 Mono 2.8 开始,CLR 4.0 成为默认版本,不再支持 CLR 1.1。
Mono 2.10 continues to use the CLR 4.0 as default and also to support the CLR 2.0.
Mono 2.10 继续使用 CLR 4.0 作为默认值并支持 CLR 2.0。
Just like the real .NET (but in far fewer cases) there are some Mono assemblies that call into native libraries. In order to make the System.Drawing assembly work on Mono, the Mono team wrote a Linux program to simulate the GDI+ portion of the Win32 API on Linux. This library is called 'libgdiplus'. If you compile Mono from source, you will notice that you need to build this 'libgdiplus' file before you can build 'mono'. You do not need 'libgdiplus' on Windows because the GDI+ portion of the Win32 API is already part of Windows. A full port of Mono to new platforms requires this 'libgdiplus' library to be ported as well.
就像真正的 .NET(但在少数情况下)一样,有一些 Mono 程序集调用本机库。为了使 System.Drawing 程序集在 Mono 上工作,Mono 团队编写了一个 Linux 程序来模拟 Linux 上 Win32 API 的 GDI+ 部分。这个库被称为“libgdiplus”。如果您从源代码编译 Mono,您会注意到您需要先构建这个 'libgdiplus' 文件,然后才能构建 'mono'。在 Windows 上不需要“libgdiplus”,因为 Win32 API 的 GDI+ 部分已经是 Windows 的一部分。Mono 到新平台的完整移植也需要移植这个“libgdiplus”库。
In areas where the design of the .NET library is overly influenced by the design of Windows, and a poor fit for systems like Mac or Linux, the Mono team has written extensions to the .NET framework. The Mono extensions are also just CIL bytecode and generally work just fine on .NET.
在 .NET 库的设计受 Windows 设计影响过大且不适合 Mac 或 Linux 等系统的领域,Mono 团队编写了对 .NET 框架的扩展。Mono 扩展也只是 CIL 字节码,通常在 .NET 上工作得很好。
Unlike on Windows, Linux generally does not detect .NET executables and launch the CLR by default. The user must usually run the CLR directly by typing 'mono appname.exe' or something similar. Here 'mono' is the application that implements the CLR and 'appname.exe' is the EXE file that contains the .NET code to be executed.
与 Windows 不同,Linux 通常不检测 .NET 可执行文件并默认启动 CLR。用户通常必须通过键入“mono appname.exe”或类似的内容来直接运行 CLR。这里的“mono”是实现 CLR 的应用程序,“appname.exe”是包含要执行的 .NET 代码的 EXE 文件。
To make things easier for users, Mono applications are often wrapped in a shell script that launches the CLR. This hides the fact that the CLR is being used just as in Windows. It is also possible to tell Linux to launch the CLR when a file using the PE file format is encountered. This is usually not done as the PE file format is also used for native Win32 Windows executables which of course the CLR (Mono) does not support.
为了让用户更轻松,Mono 应用程序通常包含在启动 CLR 的 shell 脚本中。这隐藏了 CLR 正像在 Windows 中一样使用的事实。当遇到使用 PE 文件格式的文件时,也可以告诉 Linux 启动 CLR。通常不会这样做,因为 PE 文件格式也用于本机 Win32 Windows 可执行文件,当然 CLR (Mono) 不支持。
There is no technical reason why a PE launcher could not be used by Linux which then launches either a system that understands native Windows code (like Wine) or the CLR (Mono) as appropriate. This has simply not been done to my knowledge.
没有技术原因说明为什么 Linux 不能使用 PE 启动器,然后它启动一个理解本地 Windows 代码(如 Wine)或 CLR(Mono)的系统。据我所知,这根本就没有完成。
Back and forth
来回
Any .NET code that sticks to "fully managed" code, which means it does not call into non-.NET code, should work fine on Mono on all platforms. I routinely use compiled .NET assemblies from Windows (for which I do not have the code) on Linux and Mac.
任何坚持“完全托管”代码的 .NET 代码,这意味着它不会调用非 .NET 代码,应该在所有平台上的 Mono 上都能正常工作。我经常在 Linux 和 Mac 上使用 Windows 编译的 .NET 程序集(我没有代码)。
I can also take any code that I compile on Mono and run that on .NET on Windows. I can provide a client some code I compiled with Mono and not worry if he is on 32-bit or 64-bit Windows for example. The client does need to have the right version of .NET (the right CLR) installed fo course. CLR 2.0 has been around for a very long time and you can bet almost all Windows users have it installed. The Mono compilers and other code are also just CIL executables and so they run fine on Windows if you like.
我还可以使用我在 Mono 上编译的任何代码并在 Windows 上的 .NET 上运行它。我可以向客户提供一些我用 Mono 编译的代码,而不必担心他是在 32 位还是 64 位 Windows 上。客户端确实需要安装正确版本的 .NET(正确的 CLR)。CLR 2.0 已经存在很长时间了,您可以打赌几乎所有 Windows 用户都安装了它。Mono 编译器和其他代码也只是 CIL 可执行文件,因此如果您愿意,它们可以在 Windows 上正常运行。
Mono compatibility is good enough that large chunks of actual Microsoft code, like ASP.NET MVC, can be taken (where legal to do so) from the actual MS version of .NET and run on Mac or Linux. In general, the Mono team has done a great job of implementing both the CLR and the rest of the framework (class libraries/assemblies).
Mono 兼容性足够好,以至于可以从 .NET 的实际 MS 版本中获取(在合法的情况下)大量实际的 Microsoft 代码,例如 ASP.NET MVC,并在 Mac 或 Linux 上运行。总的来说,Mono 团队在实现 CLR 和框架的其余部分(类库/程序集)方面做得很好。
ASP.NET
ASP.NET
On Windows, the Internet Information Server (IIS) knows how to call into the CLR to execute .NET as part of a web application. On Linux/Mac there is an Apache module (mod_mono) that provides similar capabilities to the Apache webserver. This application is written in C and must also be ported to new architectures.
在 Windows 上,Internet 信息服务器 (IIS) 知道如何调用 CLR 以将 .NET 作为 Web 应用程序的一部分执行。在 Linux/Mac 上,有一个 Apache 模块 (mod_mono) 提供与 Apache 网络服务器类似的功能。此应用程序是用 C 编写的,还必须移植到新的体系结构中。
Porting Mono
移植单声道
This discussion has identified parts of Mono that are built as "native" executables and must exist on a system on which you want to run .NET applications.
此讨论已确定 Mono 的部分构建为“本机”可执行文件,并且必须存在于您想要运行 .NET 应用程序的系统上。
- The CLR (including JIT compiler) - generally known as Mono
- libgdiplus (for systems which do not natively support the GDI+ API [only Windows does])
- mod_mono (to allow Apache to invoke the CLR for .NET web applications)
- CLR(包括 JIT 编译器)——通常称为 Mono
- libgdiplus(适用于本机不支持 GDI+ API 的系统 [只有 Windows 支持])
- mod_mono(允许 Apache 为 .NET Web 应用程序调用 CLR)
These three components, with the addition of the class libraries, provide a .NET environment that looks "native" to the .NET executable files you need to run.
这三个组件加上类库,提供了一个 .NET 环境,对于您需要运行的 .NET 可执行文件来说,它看起来是“本机”的。
That is how Mono works.
这就是 Mono 的工作原理。
回答by user727071
It might help you, How does Mono's C# compiler work?and as well as Understanding Mono C# Compilerbook.
它可能对您有帮助,Mono 的 C# 编译器如何工作?以及了解 Mono C# Compiler一书。