使用 Mono 进行 C# 开发的可行性
最近,我在 Ubuntu linux 中遇到了 Mono 和 MonoDevelop 软件包。 他们声称拥有符合 CLI 的 .NET 运行时。 在自己安装软件包之前,我想了解以下信息:
Mono 有多强大?
我可以开发GUI应用程序吗 linux喜欢开发WinForm Windows 应用程序。
MonoDevelop IDE 与 Visual Studio IDE 兼容吗? 我可以将 VS 2008 解决方案导入到 MonoDevelop 中并运行吗?
是否支持.NET 2.0及以上版本?
编辑:再增加一个疑问
是否有任何方法可以在 Linux 中运行 .NET exe(winform 应用程序),而无需在 Linux 中构建代码? 事实上,我没有之前开发的一些小型实用程序的代码,并且想在 Linux 中运行它们。
Recently, I came across Mono and MonoDevelop packages in Ubuntu linux. They claim to have a .NET runtime in accordance with CLI. Before installing the packages myself, I would like to know the following:
How powerful is Mono?
Can I develop GUI application for
linux like developing WinForm
applications for Windows.Is MonoDevelop IDE compatible with Visual Studio IDE. Can I import VS 2008 solutions to MonoDevelop and work?
Does it support .NET 2.0 and above?
EDIT: Adding one more doubt
Is there any way to run the .NET exe (of a winform app) in Linux without building the cod e in linux? In fact I don't have the code for some of the small utilities I developed earlier and would like to run them in linux.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
(奇怪,markdown 以 1 开始枚举,即使我从 2 开始...)
是的,你可以,但是你受限于第 3 方组件,因为内部实现不同,而且上次我检查时(不久前),Mono WinForms 实现使我的测试应用程序看起来相当奇怪(所有者绘制的)列表显示)。 虽然 Mono 声称它现在完全兼容 WinForms-2.0,但并不真正推荐。
MonoDevelop 是/曾经是 SharpDevelop 的一个分支,后者拥有解决方案支持。 不知道MonoDevelop有没有。 但最酷的是,您可以使用 Visual Studio 进行开发并在 Mono 上运行编译的应用程序。 顺便说一句,Mono 也可用于 Windows。
MonoDevelop 是/曾经
是的,就 CLR 而言确实如此。 正如 Marc Gravell 已经写过的那样,Windows Foundation 库以及其他一些库(例如 System.Management)都丢失了。 但大多数情况下应该可以正常工作,包括 ASP.NET 2.0。 Mono 的应用程序可移植性指南对此很好读。
(Strange, markdown starts the enumeration with one, even though I began with 2...)
Yes, you can, but you're limited with 3rd-party components, because the internal implementation is different, and last time I checked (not very long ago), the Mono WinForms implementation made my test app look rather strange (owner-drawn list view). It is not really recommended, though Mono claims that it's now completely WinForms-2.0-compatible.
MonoDevelop is/was a SharpDevelop branch, with the latter having solution support. I don't know if MonoDevelop has. But the cool thing is, you can just develop with Visual Studio and run your compiled apps on Mono. And Mono is, by the way, also available for Windows.
Yes, it does, as far as the CLR goes. As Marc Gravell already wrote, the Windows Foundation libraries are missing, as are a few other (System.Management, for example). But things should mostly work, including ASP.NET 2.0. Mono's application portability guidelines are a good read on this.
1:实际上相当不错。 并不是所有完整的框架都在那里,所以如果您正在编写应该在 MS .NET 和 mono 上构建的代码,您需要尽早针对这两个平台进行构建和测试
4:是的 - 尽管像 WPF/WCF/WF (3.0) 这样的东西缺失或精简
我对开发环境了解不多,因为我使用VSTS(在Windows上)并且只使用NANT脚本在mono上进行构建...
1: pretty good, actually. Not all the full framework is there, so if you are writing code that should build on both MS .NET and mono, you need to build and test early against both platforms
4: yes - although things like WPF/WCF/WF (3.0) are missing or slimmed down
I don't know much about the development environment, since I use VSTS (on Windows) and just use a NANT script to do the build on mono...
总而言之,如果您将 Mono 作为单独的目标平台,则可能会获得良好的结果。 如果您想要一个无需更改代码的 .NET 兼容层,则不必如此。
To sum things up, if you'll be using Mono as a separate target platform, you're likely to have good results. If you want a no-code-changes-required .NET compatibility layer, less so.
非常强大。 核心实现中没有重大错误。 这不是一个科学项目。 这些缺陷主要出现在您所期望的地方,即最新的 API(微软在这方面天生具有先发优势)。
是的。 我们刚刚完成了一个项目,其中大部分 GUI 代码都是在 Windows 上的 WinForms 中开发的。 我可以使用 Ubuntu 来完成它,没有遇到什么大问题。 也就是说,这是 API 最难的部分之一,并且仍然存在问题。 有关详细信息,请参阅 http://mono-project.com/WinForms。
请注意,我使用 Ubuntu Hardy (8.04)。
Very powerful. There are no major bugs in the core implementation. It is not a science project. The deficiencies are mostly where you would expect, the newest APIs (Microsoft inherently has a first-mover advantage there).
Yes. We just finished a project where most of the GUI code was developed in WinForms on Windows. I was able to work on it using Ubuntu without major headaches. That said, this is one of the hardest parts of the API, and there are still issues. See http://mono-project.com/WinForms for details.
Note, I use Ubuntu Hardy (8.04).
Mono 非常强大。 它在非常强大的开源框架上拥有所有 .Net 功能。
当您说“为 Linux 开发 GUI 应用程序就像为 Windows 开发 WinForm 应用程序”时,我理解您是在询问一个可视化设计器,它可以让您快速创建 UI。 对的,这是可能的。 MonoDevelop 有 Stetic - Gtk# 的内置视觉设计器。 还有 QyotoDevelop 可以在 MonoDevelop 中启用 QT 支持。
是的,MonoDevelop 本身支持 VS 项目/解决方案文件格式。 您可以使用相同的代码库在 Windows 上使用 .Net 中的 VS 来编译应用程序,并在 Linux 上使用 Mono 中的 win MD 来编译应用程序。
目前,Mono 支持 C# 3.0,其中一些内容超出了已经实现的范围,并且很多内容正在开发中。
目前,
是的,在许多情况下,可以在 Mono 中运行 .Net 编译的应用程序,但是有了 MonoDevelop 对 VS 解决方案的支持,这并不重要。 重建整个项目需要按 F7 一样多,所以这个工作量真的可以忽略不计。 检查应用程序是否可以在 Mono 中运行的最佳工具是 MoMA。
Mono is mighty powerful. It has all the .Net muscle on a very strong open source skeleton.
When you say "develop GUI application for linux like developing WinForm applications for Windows" I understand that you are asking about a visual designer that will allow you to quickly create the UI. Yes, it is possible. MonoDevelop has Stetic - a built-in visual designer for Gtk#. There is also QyotoDevelop which enables QT support in MonoDevelop.
Yes, MonoDevelop natively supports VS project/solution file format. You can use the same code base to compile your app with VS in .Net on Windows and win MD in Mono on Linux.
Currently Mono supports C# 3.0 with some stuff beyond that already implemented and a lot in the pipeline.
Yes, in many cases it is possible to run a .Net compiled app in Mono, however with MonoDevelop's support for VS solutions it doesn't really matter. It takes as much as pressing F7 to rebuild the whole project, so the effort is really negligible. The best tool for checking if your application can run in Mono is MoMA.
我在单声道中使用 WinForms。 2.x 版本非常好。
我在 Windows 上的 Visual Studio 中开发表单,并在 Linux 中运行它们,零代码更改。 是的,表单看起来与 XP 上的有点不同,但话又说回来,以 XP 为主题的 GUI 在 GNOME 中看起来有点奇怪。
如果您刚刚开始,请坚持使用 WinForms,同时熟悉 Mono/Linux。 然而,在某些时候您可能想要研究 GTK。
I use WinForms in mono. The 2.x releases are very good.
I develop forms in visual-studio on windows, and run them in Linux, with zero code changes. Yes, forms look a little different than on XP, but then again, an XP-themed GUI would look kind of strange in GNOME.
If you are just getting started, stick with WinForms, while you get comfortable with Mono/Linux. However at some point you might want to investigate GTK.