.Net 的平台独立性如何?

发布于 2024-10-18 12:31:55 字数 40 浏览 2 评论 0 原文

.NET框架可以安装在Linux、Unix、MAC等操作系统上吗?

Can the .NET framework be installed on Linux, Unix, MAC etc. operating systems?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

陌伤浅笑 2024-10-25 12:31:55

您应该查看 Mono 项目

单声道是

开源、跨平台、
C# 和 CLR 的实现
是二进制兼容的
微软.NET

You should have a look at the Mono Project.

Mono is

An open source, cross-platform,
implementation of C# and the CLR that
is binary compatible with
Microsoft.NET

予囚 2024-10-25 12:31:55

.Net本身与大多数 Microsoft 软件一样,100%依赖于平台。它在 Microsoft 提供的环境中工作(例如 Windows 及其不同版本)。对于其他任何东西(Mac、Linux 等)都没有官方 .Net

但是...

一些平台确实尝试开发替代品、模拟器等来尝试运行 MS软件。正如 Nick 所言,Mono 是一个支持 .Net 代码在 Linux 下运行的 Linux 项目。

但 Mono 不是 .Net。它是一个不同的软件,由不同的人编写,试图与 .Net 100% 兼容(而且它实际上非常棒)。但 Microsoft 不提供或支持它。

Mono 作为一个开源、免费的软件,是独立于平台的,因为它可以移植到任何平台(目前,它已经支持多种平台,而不仅仅是 Linux)

。正确答案是:

微软提供的.Net框架根本不独立于平台。您无法在 Linux 或 Mac 中安装它

但是 Mono,一个独立的、兼容的 .Net 实现,在 Linux 和 Mac 以及其他几个平台上都受支持并且可以安装。您可以使用它来运行用 .Net 编写的代码

.Net per-se, as most Microsoft sofware, is 100% plataform-dependent. It only works in Microsoft-provided enviroment (like Windows and its different flavors). Theres no official .Net for anything else (Mac, Linux, etc)

BUT...

Some plataforms do try to develop alternatives, emulators, etc, to try to run MS Software. Mono, as Nick posted, is a Linux project to support .Net code to run under Linux.

But Mono is NOT .Net. Its a different sofware, written by different people, that tries to be 100% compatible with .Net (and its actually damn awesome). But its not provided or supported by Microsoft.

And Mono, being an open-source, free sofware, is plataform-independent, as it can be ported to any plataform (currently, it already support several, not only Linux)

So, technically speaking, the correct answer would be:

.Net framework, as provided by Microsoft, is not plataform-indepedent at all. You can not install it in either Linux or Mac

But Mono, an independent, compatible .Net implementation, is supported and avaliable for install in both Linux and Mac, among several other plataforms. And you use it to run code written in .Net

浪漫人生路 2024-10-25 12:31:55

Linux 具有 Mono,它是 Linux 的 .Net 运行时。我不知道其他操作系统的情况。
不管怎样,它之所以独立于平台是因为它被编译为 MSIL,因此任何平台都可以实现运行时并支持它。

还有一个针对小型嵌入式设备的实现,称为 .Net Micro Framework

Linux has the Mono which is a .Net runtime for Linux. I do not know about other OS's.
Anyway, what makes it platform independent is the fact that it is being compiled to MSIL so any platform can implement the run-time and support it.

There is also an implementation for small embedded devices called .Net Micro Framework.

远昼 2024-10-25 12:31:55

.Net 可以被视为两个独立的部分。一种是 ECMA 标准化 CLI,另一种是 CLR。 CLR 是 Microsoft 对 CLI 的实现。

CLI 可以在许多设备上执行,例如 Windows(x86、x64、ia64 和现在的 ARM)、XBox、Zune、移动电话,甚至 嵌入式设备(小芯片)Mono/Moonlight 是 CLI 的实现,甚至是 CLR 的一部分,由 Microsoft 通过 Novell 提供部分资助。 Microsoft 支持这项工作并发布源代码来提供帮助。通过 Mono,您可以访问大多数操作系统和 CPU 类型。

还有编译器可以将.Net代码直接编译为CPU可以直接执行的平台无关代码。如果您想用 C# 编写自己的操作系统,那就太好了。 (我不记得名字了,但如果有兴趣,我可以在 Google 上搜索一些链接。)

CLI 被设计为独立于平台和语言。通过各种实现,它可以在大多数操作系统和 CPU 上运行良好。实际上,这是否意味着它支持诸如区分大小写/不区分大小写的变量等语言功能(+更多),并且它具有与大多数 CPU 兼容的指令集(CLI 机器代码类似于大多数 CPU 提供的指令)。

.Net 的实现(回答您的问题的概述):

  • Microsoft .Net Framework:Windows
  • < a href="http://en.wikipedia.org/wiki/.NET_Compact_Framework" rel="nofollow noreferrer">Microsoft .Net Compact Framework:Windowsm Xbox、Zune、移动设备
  • Microsoft .Net Micro Framework:嵌入式/非常有限的设备
  • Mono:Unix、Linux、Windows、Mac

.Net can be looked at as two separate parts. One is the ECMA standardized CLI and the other is CLR. CLR is Microsofts implementation of CLI.

CLI can be executed on many devices, such as Windows (x86, x64, ia64 and now ARM), XBox, Zune, mobile phones and even embedded devices (small chips). Mono/Moonlight are implementations of CLI and even parts of CLR partially funded by Microsoft through Novell. Microsoft supports this work and releases source code to aid. Through Mono you can reach most operating systems and CPU types.

There are also compilers that can compile .Net code directly to platform independent code that can be directly executed by the CPU. Nice in case you want to write your own operating system in C#. (I don't remember names, but I can Google some links if interested.)

CLI is designed to be platform and langugage independent. It runs well on most operating systems and CPU's through various implementations. In practice does this mean that it supports for example language features such as case sensitive/case insensitive variables (+ muuuch more) and it has an instruction set compatible with most CPU's (the CLI machine code resembles the instructions most CPU's offer).

Implementations of .Net (overview to answer your question):

薆情海 2024-10-25 12:31:55

对你非常精确的问题的回答是否定的。对于“.net 程序能否在这些操作系统上运行”这个问题的回答是不同的。也许吧。正如其他人所写,寻找 Mono。

附录(这是后来的编辑)

我现在认为我的答案并不完整。我应该回答“是的。你安装 wine,然后安装 .net 框架”。这里有一个示例链接(适用于 ubuntu 和 .net 2.0): http://ubuntuforums.org/ showthread.php?t=943298

是的,我知道这不是OP可能想知道的答案,但这至少是他所问问题的部分答案。

The response to your very precise question is NO. The response to the question "can a .net program be run on these OS" is different. And it's MAYBE. As written by others, look for Mono.

Addendum (this is a later edit)

I now think my answer wasn't complete. I should have answered "Yes. You install wine and then install the .net framework". Here a link with an example (for ubuntu and .net 2.0): http://ubuntuforums.org/showthread.php?t=943298

Yes, I DO know this isn't the answer to what the OP probably WANTED to know, but it's at least a partial answer to what he ASKED.

阳光①夏 2024-10-25 12:31:55

您需要使用名为 Mono 的免费开源替代 .NET 实现

在维基百科上

主站点

You need to use the free and open sourced alternative .NET implementation called Mono

On wikipedia

Main site

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文