开发者

How cross-platform .Net framework really is?

开发者 https://www.devze.com 2022-12-29 07:53 出处:网络
What is normally to be done to run a WinForms application on a Mac or Linux machine? a. Just copy and run (开发者_开发知识库assuming they have a Framework installed).

What is normally to be done to run a WinForms application on a Mac or Linux machine?

a. Just copy and run (开发者_开发知识库assuming they have a Framework installed).

b. Rebuild.

c. Cosmetic source code modifications.

d. Heavy source code modifications and forms redesign.

Assuming that the application is developed as 100% managed C# 3 code by means Visual C# Express or Visual Studio 2008 targeting .Net Framework 3.5, developed without using any 3-rd party components/libraries, without encapsulating nonmanaged code or any low-level hacks - only standard Microsoft-documented .Net Framework C# API used). Or the same conditions but C# 4 language, .Net Framework 4 and Visual Studio 2010.

Is there somewhere a practical guide for developing Mono-ready applications while using MS .Net Framework and Visual Studio? Any guidelines, tips, specific aspect highlights, informing a developer of what he really needs to keep in mind to write an easily portable application without having to lookup every function in the Mono reference while coding in Visual Studio.


It is possible that your app will just run with zero modifications, but I've yet to see that happen in the real world.

A tool which may help you a great deal is MoMA. MoMA is made by the same folks who make Mono, and will tell you if you are using any features that have not yet been ported.

In general, .NET 3.5 and Winforms is mostly OK. Compatibility with version 4 is still very much in development.

A more up to date tool, if you're doing your development on Windows, is the .NET Portability Analyzer from Microsoft. This can be used via Visual Studio.


If it's a Windows Forms application, using standard Windows Forms controls, and no 3rd party components, you can typically run this on Mono directly, just by doing a copy and run.

Mono supports Windows Forms and C# 3 features very well.

However, if you use any native components, data access outside of what is supported by Mono, or WPF, you'll run into issues. C# 4/.NET 4 will most likely not work at this point, either.


Well, i didn't develop large projects, but from my experience you would have to introduce some minor modifications to your code, but just to refine some things. The application itself should run just fine without recompilation. As for windows forms, i found it to be extremely slow some times when working with GDi, but maybe i was just doing something wrong. However, the Mono team claims it has full support of windows forms.

One more thing worth to mention. It is really hard to write a cross-platform application, which wont be harsh without using some native OS features. I think you should always consider a possibility to write some additional OS-specific modules to provide a tight integration with the underlying OS and leverage some cool stuff (like an awesome toolbar features in OSX). You should also remember, that people are used to different look&feel on different OS's


Theoretical, .Net is fully cross platform, as it doesn't depend on specific architecture, but on a VM.

In practice though, you have the microsoft implementation for windows, and the mono implementation for linux/mac. The main problem is that the implementations can differ from each other, making it hard to run an application on multiple machines out of the box.

Source code shouldn't have to be altered, if not some of the libraries are not ported to mono, or different libraries are used.

C# 4 can be a bit harder, because mono isn't yet up-to-date to the microsoft implementation.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号