如何在 C# .NET 中编写程序,在 Linux/Wine/Mono 上运行它们? [英] How to write programs in C# .NET, to run them on Linux/Wine/Mono?

查看:18
本文介绍了如何在 C# .NET 中编写程序,在 Linux/Wine/Mono 上运行它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这种特殊情况下,我需要为 Linux 运行 .complicated NET 应用程序. 我的意思是复杂 - 该项目已经开发了 3 年,我不想再用 java 或其他东西,开发和支持,.NET 和 Java 版本.

In this particular case I need to run .complicated NET application for Linux. By complicated i mean - that project was developed for 3 years and i don't want to write it again in java or something else and develop and support both, .NET and Java version later.

应用程序正在生成鼠标和键盘事件(通过 winapi/dll 导入)并使用串行端口.我也有很少的延迟计时器 - 用于串行端口通信(10-20ms,我在这里不需要很大的精度).

Application is generating mouse and keyboard events (by winapi/dll import) and uses serial port. I have also few timers for delays - for serial port communication (10-20ms, i dont need big precision here).

剩下的只是一堆简单的代码,没什么特别的,没有奇怪的控件,没有directx等.

The rest is just a lot of simple code, nothing special, no weird controls, no directx etc.

我应该期待什么?这行得通吗?

What should i expect? Will this work?

如果代码的某些部分会失败 - 我可以稍微更改一下,在 .net 应用程序和 linux 上的迷你应用程序之间建立网络连接,我可以编写用于发送鼠标和键盘事件或 RS232 通信.

If some part of code will fail - i can change it a little, make network connection between .net app and mini-application on linux that i can write for sending mouse and keyboard events, or RS232 communication.

另外我想问一下 Wine 和 .NET 的一般情况:

如何编写应该在 Linux/Wine/Mono 上运行的 .NET 应用程序?

How to write .NET applications that should run on Linux/Wine/Mono?

  • 哪个版本的框架?(1.x、2.0 还是我可以使用 3.5?)
  • 我应该避免什么(从 Windows dll 导入?计时器?)

编辑/从评论中移动:

几年前我看过单声道,但很糟糕.现在我看到它长大了,支持 LINQ、Threading 和其他复杂的功能.另外现在帮助看起来真的很严重.我还没有接受答案,因为我看到人们仍然发布非常有用的链接.如果这个问题得到很多 +1,我会重写它,也许这会对其他人有所帮助.

I saw mono few years ago, but it was terrible. Now i see it growed up, supports LINQ, Threading and other complicated features. In addition now help looks really serious. Im not accepting answer yet, because i see that people still posting very useful links. If this question gets many +1 i will rewrite it and maybe this will help others.

我希望这里有人在这里对 .NET on linux 有一些实践经验...

I hope someone here have some practical experience with .NET on linux here...

推荐答案

你在 http://www.mono 上阅读过 Mono.NET-project.com?

它允许您为 Linux 编写 .NET 应用程序,与 Microsoft 实现略有不同.我不认为 wine 可以处理任何 .NET 组件.

It allows you to write .NET apps for Linux with minor differences over the Microsoft implementation. I don't think wine will cope with any of the .NET components.

只需阅读之前的文档就可以了.

Just read the documentation before and you have a go.

PS:这也为您提供了单声道和 .NET 之间的兼容性列表.http://www.mono-project.com/CompatibilityMoMA(mono migration analyzer) 是一个工具,它可以扫描任何已经创建的 .NET 应用程序,看看它是否兼容部署在 linux 上.

PS: This also gives you the compatibility list between mono and .NET. http://www.mono-project.com/Compatibility and MoMA(mono migration analyzer) is a tool that will scan any .NET app already created to see if its compatible to deploy on linux.

这篇关于如何在 C# .NET 中编写程序,在 Linux/Wine/Mono 上运行它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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