简体   繁体   English

Linux上的MonoDevelop for .NET应用程序

[英]MonoDevelop for .NET application on Linux

I need to develop C# applications, but i use Linux (ubuntu), I found MonoDevelop, but I don't understand if i can write .NET applications from Linux to use on Windows, so the development on linux and the execution on Windows. 我需要开发C#应用程序,但是我使用Linux(ubuntu),我找到了MonoDevelop,但我不明白我是否可以从Linux编写.NET应用程序以在Windows上使用,因此Linux上的开发和Windows上的执行。 are them compatible? 他们兼容吗?

On the Mono website I found: 在Mono网站上我发现:

Mono is a software platform designed to allow developers to easily create cross platform applications. Mono是一个软件平台,旨在让开发人员轻松创建跨平台应用程序。

What does it means? 这是什么意思? Can I write on Linux c# applications that can run wherever the .NET framework is installed? 我可以在可以在.NET框架安装的任何地方运行的Linux c#应用程序上编写吗?

Thank you for the clarification 谢谢你的澄清

Any C# code you compile from MonoDevelop or anywhere else can be run on any platform with either Mono or the .NET Framework. 您从MonoDevelop或其他任何地方编译的任何C#代码都可以在任何具有Mono或.NET Framework的平台上运行。 As long as the linux system has Mono installed, it can run any compiled C# application, including .exe's copied from a Windows machine. 只要linux系统安装了Mono,它就可以运行任何已编译的C#应用​​程序,包括从Windows机器复制的.exe。

The reason for this is that when you compile a C# application, it's not being compiled to native system code, it's being compiled to CIL . 这样做的原因是,当您编译C#应用程序时,它没有被编译为本机系统代码,而是被编译为CIL When you run the program, it automatically JIT compiles your code for the system it's running on, leaving the original executable intact. 当您运行该程序时,它会自动JIT编译您正在运行的系统的代码,保留原始可执行文件。 Both the .NET Framework on Windows and Mono on everything else can read and compile the CIL bytecode. Windows上的.NET Framework和其他所有内容上的Mono都可以读取和编译CIL字节码。

And one thing to keep in mind, Mono doesn't have the entire .NET Framework stack available. 有一点要记住,Mono没有可用的整个.NET Framework堆栈。 Almost all of the BCL is intact, but libraries like WPF are not available on Mono. 几乎所有的BCL都是完整的,但像Mono这样的库不能用于WPF。 Mono recommends you use GTK# for your GUIs. Mono建议您使用GTK#作为GUI。

Yes, you can use mono to create .NET applications that will run on Linux, Windows and Macs. 是的,您可以使用mono创建可在Linux,Windows和Mac上运行的.NET应用程序。

Mono is : 单声道是

It is an open source implementation of Microsoft's .Net Framework based on the ECMA standards for C# and the Common Language Runtime. 它是Microsoft的.Net Framework的开源实现,基于ECMA的C#标准和公共语言运行时。

This means that so long as you don't write code that is platform specific, you can run it on all platforms that .NET can run on. 这意味着只要您不编写特定于平台的代码,就可以在.NET可以运行的所有平台上运行它。 (So, instead of concatenating paths using \\ or / you use Path.Combine , and instead of hardcoding linebreaks as \\n you use Environment.NewLine and such). (因此,代替串联路径的使用\\/您使用Path.Combine ,而是硬编码换行符作为\\n使用Environment.NewLine并且这样的)。

Another advantage is that the mono development tools are free. 另一个优点是单声道开发工具是免费的。 (see: http://www.mono-project.com/Main_Page ) (见: http//www.mono-project.com/Main_Page

You can indeed write .NET code in Mono on Linux and run the application on Windows, Mac OS X and Linux. 您确实可以在Linux 上的Mono中编写.NET代码,并在Windows,Mac OS X和Linux上运行该应用程序。
But keep in mind that the full .NET stack is not available for you. 但请记住,完整的.NET堆栈不适合您。 Most noticeable is the complete lack of WPF support . 最值得注意的是完全缺乏WPF支持

You can as long as you are careful to not assume anything about things like file system layout and use libraries that are also portable. 只要你小心不假设文件系统布局之类的东西,并使用也可移植的库,你就可以。 Graphical interfaces in particular are problematic: Windows.Forms looks alien on Linux, and Gtk may feel a little out of place on Windows. 特别是图形界面存在问题:Windows.Forms在Linux上看起来很陌生,而Gtk在Windows上可能会有点不合适。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM