是否可以在Linux OS中运行.net应用程序

问题描述:

是否可以在Linux OS中运行.NET应用程序?

Is it possible to run .NET application in linux OS

您应该看看 ^ ].
这里有一个入门指南 [ ^ ].
我本人从未使用过它,因此超出这一点我将无济于事.
祝您好运:)
You should take a look at Mono[^].
There''s a starters guide[^] on the website too.
I''ve never worked with it myself though, so I can''t help you beyond this point.
Good luck :)


Naerling的建议很好,但是我对Mono的配合也足够:它可以工作.基本上,您可以在Windows或其他平台上开发应用程序,并且生成的可执行文件可以在Mono 下的任何其他平台上运行,而无需重新编译.

这是可能的,因为Mono是CLR的另一种实现,并且因为CLR和IL基于JIT(即时)编译.可执行代码会在任何平台上加载,然后进行JIT编译,通常是在每次方法即将被首次调用时按方法完成.

请参阅:
http://en.wikipedia.org/wiki/JIT_compiler [ http://en.wikipedia.org/wiki/Common_Intermediate_Language [ http://en.wikipedia.org/wiki/Common_Language_Infrastructure [ http://en.wikipedia.org/wiki/Common_Language_Runtime [ http://en.wikipedia.org/wiki/Mono_%28software%29 [ ^ ],
http://www.mono-project.com/ [ http://en.wikipedia.org/wiki/Base_Class_Library [ C ++ GUI对于Linux,一个开始的地方 [通过linux编程GUI [任何Visual Studio应用程序的平*立性 [ ^ ],
我有开发可在Linux + Windows上运行的exe文件 [如何在Windows7中使用单声道? [ ^ ],
为winforms C#.Net创建单声道 [ ^ ].

-SA
The advice by Naerling is good, but I also worked enough with Mono: it works. Basically, you can develop your applications on Windows or some other platform, and the resulting executable file will work on any other platform under Mono without recompilation.

This is possible because Mono is another implementation of CLR, and because CLR and IL are based on JIT (Just-in-time) compilation. The executable code is loaded on any platform and then JIT-compiled, with usually is done on per-method basis, when a method is about to be called for the very first time.

Please see:
http://en.wikipedia.org/wiki/JIT_compiler[^],
http://en.wikipedia.org/wiki/Common_Intermediate_Language[^],
http://en.wikipedia.org/wiki/Common_Language_Infrastructure[^],
http://en.wikipedia.org/wiki/Common_Language_Runtime[^].

On Mono itself:
http://en.wikipedia.org/wiki/Mono_%28software%29[^],
http://www.mono-project.com/[^].

The possible problems are related, of course, to compatibility. But in this case, this problem is much easier than in other cases. First of all, everything is based on the ECMA-335 standard for CLI, which includes nearly everything, including the specification for the Basic Class Library (BCL):
http://en.wikipedia.org/wiki/Base_Class_Library[^].

If you use only the BCL, most likely your code will be compatible. You should also avoid using any platform specific feature and P/Invoke. But you can also successfully use a number of non-standard libraries, importantly, System.Windows.Forms and ADO.NET. Of course, you can also develop platform-specific code, but just on different platforms.

Please see also my past answers:
C++ GUI For Linux, looking for a place to start[^],
Programming GUI over linux[^],
Platform independency of any visual studio application[^],
I have to develop an exe file that runs on Linux + Windows[^],
how can i use mono in windows7?[^],
To create mono for winforms C#.Net[^].

—SA


^ ]
http://www.zdnet.com/how-to-run-net -applications-on-linux-2062100755/ [ http://www.novell.com/connectionmagazine/2010/02/mono_tools.html [ ^ ]
http://linuxpoison.blogspot.com/2010/11/how-to-compile-and-run-c-net.html [
http://*.com/questions/887193/how-to-run-net-application-on-linux-environment[^]
http://www.zdnet.com/how-to-run-net-applications-on-linux-2062100755/[^]
http://www.novell.com/connectionmagazine/2010/02/mono_tools.html[^]
http://linuxpoison.blogspot.com/2010/11/how-to-compile-and-run-c-net.html[^]