且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Mono:在Windows上开发,在Linux上运行

更新时间:2022-12-07 10:40:38

从理论上讲,在"true" .NET中工作的任何东西在Mono中都将完全相同.
:laugh :: laugh :: laugh :: laugh :: laugh:

我练习,大部分会.其中一些将非常紧密地工作,一些将完全失败,而某些根本没有实现.

如果您坚持使用.NET 2.0,则大多数mono都将像魅力一样工作-当我遇到问题时,一直在Linux上为网站运行Mono,我没有在Winforms上尝试过.

如果您可以在Windows下以Mono为目标,而不是使用"true" .NET框架,那么您将更好地了解什么将立即生效,而下次将EXE转移到Linux机器上时,尝试运行它.从来没有尝试过,也不知道VS的效果如何.

听起来是负面的?有点,但这反映了我的经验.大部分情况下都是非常成功的,但是当代码在"true" .NET上运行正常时,然后在Mono下失败,并且花了很长时间尝试找出出了什么问题之后,便深感沮丧.
In theory, anything that works in "true" .NET will work exactly the same in Mono.

:laugh::laugh::laugh::laugh::laugh:

I practice, most of it will. Some of it will work pretty closely, some will fail completely, and some isn''t implemented at all.

Provided you stick to .NET 2.0 most of mono will work like a charm - when I have had problems is has been running mono on Linux for a website, I''ve not tried it for Winforms.

If you can target for mono under windows, rather than using the "true" .NET framework then you will get a better idea of what will and won''t work immediately, rather than when you next transfer your EXE to the Linux box and try to run it. Never tried that, and don''t know how well VS will work.

Sound negative? It is a bit, but it reflects my experiences. Very successful for the most part, but deeply frustrating when code works fine on "true" .NET then fails under Mono and you spend ages trying to work out what went wrong.


编译器是不同:一种是Microsoft专有的,另一种是开源Mono.
您可以在.NET上进行开发,而无需在Mono上重新编译即可运行.
您需要检查Mono文档的兼容性: http://www.mono-project.com/Compatibility [ ^ ].

主要思想是:CLI是ECMA和ISO中的标准化问题.参见 http://www.ecma-international.org/publications/standards/Ecma-335.htm [^ ] .特别是,该标准定义了.NET库的标准部分.
库的标准部分应在.NET和Mono之间兼容,请使用很多非标准库,包括System.Windows.Forms.我亲自开发了可立即在Mono上运行的.NET Forms应用程序.我尝试非常准确地做到这一点,从一开始就试图确定潜在的可移植性问题,并且对兼容性基本满意.在.NET v.3.5之前还不是很好,但是现在我没有任何抱怨.

—SA
The compilers are different: one it Microsoft proprietary, another on is Open Source Mono.
You can develop on .NET and run without recompilation on Mono.
You need to check Mono documentation for compatibility: http://www.mono-project.com/Compatibility[^].

Main idea is: CLI is the matter of standardization in ECMA and ISO. See http://www.ecma-international.org/publications/standards/Ecma-335.htm[^]. In particular, the standard defines standard parts of the .NET library.
The standard part of library should be compatible between .NET and Mono, please good deal of non-standard libraries, including System.Windows.Forms. I personally develop .NET Forms applications which run on Mono right away. I try to do it very accurately, trying to identify potential portability problem from the very beginning and basically satisfied with the compatibility. It was not so good before .NET v.3.5, but right now I do not have complains.

—SA