36

有没有人在大型或中型项目中使用过 Mono,开源 .NET 实现?我想知道它是否已准备好用于现实世界的生产环境。它是否稳定、快速、兼容、......足够使用?将项目移植到 Mono 运行时是否需要付出很多努力,或者它是否真的非常兼容,足以为微软的运行时获取并运行已经编写的代码?

4

8 回答 8

31

我已经将它用于许多内部和商业项目,并取得了巨大的成功。我的警告:

  • 编写大量单元测试并确保它们都在 Mono 下通过——这将为您省去很多麻烦。
  • 除非你绝对必须,否则不要使用他们的嵌入 API。它非常易于使用,但是垃圾收集有效内存或泄漏所有内存非常容易。
  • 永远不要接近 SVN,除非别无选择,否则不要自己编译。SVN 中的事情变化如此频繁,如果您的项目非常大,您很可能最终会实现一些在发布版本上不起作用的东西。
  • 不要长时间尝试自己解决问题,请使用 IRC 频道。那里的人很乐于助人,你会日复一日地拯救自己——不要犯我犯的同样错误。

祝你好运!

编辑:我说不要从源代码(发布或 SVN)编译你自己的原因是它很容易配置它而不是发布二进制文件和隐藏错误,例如在垃圾收集中。

编辑2:忘记回答您的问题的第二部分。就我而言,移植代码没有问题,但我没有使用任何特定于 MS 的库(WinForms、ASP.NET 等)。如果你只使用 System.* 东西,你会没事的;除此之外,您可能会遇到问题。不过,Mono 2.0 相当可靠。

于 2008-10-08T07:44:10.930 回答
5

我发现 Mono 主要与 MS 二进制兼容。因此,我只是用 MS 编译,然后在任何地方运行,就像 Java 本来的样子!

Mono 在 Linux 上的性能非常接近 MS,在某些情况下慢了 2 倍,而在 Windows 上运行 Mono 时慢了 5-10 倍(但你真的应该坚持使用 MS)。

于 2008-10-08T08:10:29.363 回答
5

I had some experience with Mono.

Pure .NET stuff (like business logic, controllers or algorithms) can be ported without any problems. Yet, weird things start showing up in the components that interact with operating system, UI, services or persistence. So be prepared for some debugging and hacking.

Things that might help:

  • Component-Driven Development - so that code is reused by Windows .NET and Mono, while differences are isolated and tested)
  • Continuous Integration running and checking everything against Mono and MS.NET, so that possible issues could be discovered as fast as possible (automated deployment and sanity checks are also recommended)
  • There are not a lot of UI component suites for shell development in Mono.
  • When a component vendor says that his code is "compatible with Mono", it is not same as "runs on Mono and is supported".

Although in the present, there are some companies going into production with Mono, I'd still wait before rushing in there due to:

  • Lack of decent and commercially supported UI component suites
  • Issues with efficient garbage collection
  • Not the best debugging experience (compare with the historical debugger in VS 2010)

PS: if there is a company offering fully managed cloud computing solution (not just a VM, but more like Hadoop equivalent for .NET), then I'll be forced to jump in despite these issues.

于 2009-06-13T11:35:37.013 回答
3

如果您正在做 ASP.NET 2.0 的工作,它工作得很好。Winforms 可能会工作,但可能会导致显示问题。如果您希望表单应用程序具有兼容性,我建议您使用 GTK#,因为它是跨平台的。

就像建议的那样,只要你彻底测试,如果这对你来说是一个可行的选择,我会同意在商业上使用它,除非它是你需要的 winforms。在我看来,我会暂时远离它。忘记 WPF,因为目前没有支持,而且可能永远不会有(尽管他们正在研究月光,也就是 linux 的 silverlight)

于 2008-10-08T07:58:25.787 回答
1

我自己没有使用过 Mono,但您可能有兴趣知道 FogBugz 使用 Mono 在 Linux 平台上提供 Lucene.NET。(我之所以知道这一点,是因为 Joel 在 Stack Overflow Podcast #24 中提到过。)

于 2008-10-08T07:50:41.323 回答
0

我有一堆正在生产的 shell 应用程序。

我同意@cody-brocious,写了很多单元测试。我过去发现正则表达式的工作方式与 windows CLR 的工作方式并不完全相同。

它实际上比你想象的要简单,只需编译和运行。如果你在你的项目中使用 NAnt,它更容易过渡。

我通常从源版本安装单声道,我没有遇到任何问题。

于 2008-10-09T12:11:48.863 回答
0

我已经将它用于加密/解密工具,并且效果很好。

将来,我会考虑使用 Mono/C#,但我不希望它与Windows 上的 .Net 100%完全一样。

于 2008-10-17T18:45:55.260 回答
0

当然,您可以,尤其是在 Mono 2.0 发布之后。Mono 2.0 已准备好用于实际项目。

你可以检查这个

于 2008-10-22T15:11:57.670 回答