为什么在Windows上安装Mono [英] Why install Mono on Windows

查看:133
本文介绍了为什么在Windows上安装Mono的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读过Mono是Windows以外平台的.Net Framework实现。因此,它应该允许您使用相同的库和东西。



在Windows中安装Mono有什么意义?

不是为其他平台开发的代码与.Net完全兼容,因此我应该能够将它复制粘贴到Visual Studio然后编译?



谢谢!

I've read that Mono is an implementation of the .Net Framework for platforms other than Windows. Hence, it should allow you to use the same library and stuff.

What is the point then of installing Mono in Windows?
Isn't the code developed for other platforms perfectly compatible with .Net, and hence I should be able to copy-paste it to Visual studio and then compile?

Thank you!

推荐答案

在许多情况下,在Windows上安装Mono非常重要。这取决于你对Mono的期望。其中一种情况是您希望进行CLI开发,并在多个平台(包括Windows)中开发代码,Windows是您的主要开发平台。



原则上,你可以在Windows上使用.NET(使用Visual Studio或不使用),在Window上测试它,然后在其他平台上测试它。 您无需重新编译在Windows上制作的程序集。理想情况下,它可以正常工作,而且通常是单词。在实际情况下,它可能会导致问题。原因很简单:Mono不是100%兼容;它甚至不应该100%兼容,即使在许多情况下兼容性非常好。例如,WPF和.NET FCL的其他部分从未为Mono开发。 BCL应该是完全兼容的,以及FCL的一些非标准部分,例如 System.Windows.Forms (是的,这些程序集不是ECMA环境标准)。但是,有一些不兼容的部分,特别是在不属于BCL的FCL中。我甚至还记得一个案例,其中人们报告了一些.NET行为作为一个bug,这是在Mono中修复的,这是一种不兼容性(;-))。我在Mono中看到了一些实现错误,我在.NET中找不到,所以我不得不应用一些解决方案。



由于这些不兼容性,在Windows上工作的一种有效方法是使用.NET和Mono。这两个运行时环境是完全隔离的,因为您以不同的方式运行应用程序:

It is really important to install Mono on Windows, in many cases. It depends on what do you expect from Mono. One of such cases is when you want to do the CLI development, and develop code in more then one platform, including Windows, with Windows being your primary development platform.

In principle, you could do it using only .NET on Windows (with Visual Studio or not), test it on Window, and then test it on some other platform(s). You don't need to recompile your assemblies made on Windows. Ideally, it can work and often words. In real cases, it may cause problems. The reason is simple: Mono is not 100% compatible; and it is not even supposed to be 100% compatible, even though the compatibility if very good in many cases. For example, WPF and other parts of .NET FCL were never developed for Mono. BCL is supposed to be fully compatible, as well as a number of some non-standard parts of FCL, such as System.Windows.Forms (yes, these assemblies are not part of the ECMA standard for the environment). However, there are some incompatible pieces, especially in FCL which is not part of BCL. I even remember one case where people reported a bit of .NET behavior as a bug, which was fixed in Mono, which is a kind of incompatibility (;-)). And I saw some implementation bugs in Mono, which I did not find in .NET, so I had to apply some work-around solutions.

Due to these incompatibilities, one of the effective methods of work on Windows would be using both .NET and Mono. The two runtime environments are fully isolated, because you run applications in different ways:
:: for .NET for Windows:
someApplication.exe

:: for Mono on all platforms:
mono someApplication.exe



这是你可以做的:在Windows上开发一些代码,测试它在.NET for Windows上,然后在Mono for Windows上重新测试它。在最后一步之后,Mono for Windows上的代码行为将最大程度地接近其他平台上Mono的预期行为,但仅当您的产品所依赖的其他产品也安装在两个平台上时,相同或兼容的版本中。



-SA


这就是理论,是的 - 总的来说也是如此。



但是......我试图开发代码来运行linux / mono下的网站,在Windows上用.NET作为开发环境,这是一个练习纯粹的沮丧。在移植到发布Web主机时,开发中运行良好的功能失败了。好的,那是几年前的事情,情况可能已经改善了很多,它可能已经使用了一些不太常见的.NET框架,但是我放弃了网络主机(尽管是在所有其他方面都很完美)并转移到我当前在其服务器上运行Windows和.NET的主机。



也许如果我在我的开发机器上安装了Mono,我会没有这么沮丧 - 我不知道。也许现在,Mono是完全兼容的,我不会有任何这样的问题。但是我的时间足以让我说大象吧!除非我真的,真的必须这样做,否则不再触摸单声道。
That's the theory, yes - and by and large it's true.

But...I have tried to develop code to run a website under linux / mono with .NET on Windows as the development environment, and it was an exercise in pure frustration. What worked fine in development failed nastily and badly when ported to the release web host. OK, that was a couple of years back, and the situation may well have improved lots, and it may have been using some of the "less common" .NET framework, but it was bad enough that I abandoned the web host (despite being perfect in all other ways) and moved to my current host which runs Windows and .NET on it's servers.

Perhaps if I had installed Mono on my development machine I would not have got so frustrated - I don't know. And maybe now, Mono is fully compatible and I wouldn't have any such problems. But my time is valuable enough to me to say "Elephant it!" and not touch mono again unless I really, really have to.


这篇关于为什么在Windows上安装Mono的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆