简体   繁体   English

如何在Mono中使用现有的.NET 4.0应用程序?

[英]How to use an existing .NET 4.0 app with Mono?

I have a functional .NET WinForms app that uses all the latest features of .NET 4.0 / C# 4.0, such as reflection, dynamic code generation (CIL), extensions, user components, etc. Is it easy to run this app on Mono? 我有一个功能正常的.NET WinForms应用程序,该应用程序使用.NET 4.0 / C#4.0的所有最新功能,例如反射,动态代码生成(CIL),扩展,用户组件等。在Mono上运行此应用程序容易吗? I currently want to see it fully functional on Windows 7, and if all is well then I'll try running it on Unix. 我目前想在Windows 7上看到它的全部功能,如果一切正常,那么我将尝试在Unix上运行它。 Is this easily possible or do I have a large "porting" job ahead? 这很容易实现吗?还是我前面有大量的“移植”工作?

Yeah, just copy the .exe and .dll files over to the Linux box, and run the app: 是的,只需将.exe和.dll文件复制到Linux框中,然后运行该应用程序:

mono yourapp.exe

I recommend you mono 3.x, not older. 我建议您使用mono 3.x,而不是较旧的版本。

Most glitches you find will most probably have to do with path assumptions (like using "\\" to concatenate paths instead of using Path.Combine). 您发现的大多数故障最有可能与路径假设有关(例如使用“ \\”连接路径而不是使用Path.Combine)。 A workaround for this is to use an environment variable defined here: http://www.mono-project.com/IOMap 解决方法是使用此处定义的环境变量: http : //www.mono-project.com/IOMap

Everything except UI should run fine on Mono. 除UI外,其他所有内容都应在Mono上正常运行。 On MonoTouch however, the code is statically linked so certain reflection features are unavailable (like emitting code and virtual generic methods). 但是,在MonoTouch上,代码是静态链接的,因此某些反射功能不可用(例如发出代码和虚拟通用方法)。

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

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