如何在C#中在Windows上开发mac应用程序? [英] How to develop a mac application on windows in C#?

查看:812
本文介绍了如何在C#中在Windows上开发mac应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





有没有办法在Windows上使用c#在没有安装mac的情况下在虚拟机上开发macos应用程序。我已经阅读了关于xamarin跨平台开发的内容,但它只支持ios和Android移动应用程序,但不支持mac应用程序。



请帮忙。

Hi,

Is there any way to develop a macos application on windows using c# without installation mac on virtual machine. I have read about xamarin cross platform development but it supports only ios and Android mobile application but not mac application.

Please help.

推荐答案

我用它来使用Mono并使用.NET语言开发的唯一方法。您可以在Mac OS X上安装Mono.Mono是可用于许多平台的替代CLR实现(请参阅下面的链接)。



您可以从.NET开发开始,如果这对你来说更方便。然后你需要在Mono for Windows上测试它。通常,如果您在Mac OS X上具有相同的Mono设置和其他相同的组件,则您的代码无需重新编译即可运行。主要区别在于.NET和Mono(甚至在Windows上),因此它将成为解决跨平台问题的主要工作。



请参阅:

http://en.wikipedia.org/wiki/Mono_%28software%29 [ ^ ],

http://www.mono-project.com/ [ ^ ],

http://en.wikipedia.org/wiki/.NET_Framework [ ^ ],

http://en.wikipedia.org / wiki / CLR [ ^ ]。



如果你想要关闭行为对于本机Mac OS X行为,您将需要像monobjc这样的项目:

http:// en。 wikipedia.org/wiki/Monobjc

http://www.monobjc.net/



有了它,Windows上的开发将变得更加困难。尽管如此,你仍然可以在Windows上编译它,但你无法使用可视化编程 - 最糟糕的是 - 无法在Mono for Windows上进行测试。您需要在MonoDevelop上完成大部分工作:

http://en.wikipedia.org / wiki / MonoDevelop

http://www.monodevelop.com
http://en.wikipedia.org/wiki/Standard_Libraries_%28CLI%29#Base_Class_Library [ ^ ]。



更糟糕的是,你需要在MonoDevelop for Windows上做相当大的部分工作。



或者,你可以使用 System.Windows.Forms 应用程序(一些不兼容的应用程序,所以使用Mono for Windows来测试所有东西),但是这些应用程序在Mac OS X上看起来有点丑陋和外来。 System.Windows.Forms 不是BCL的一部分(见上文)并且不是标准根据EMCA的CLR标准编写。请阅读Mono便携性: http://www.mono-project.com/docs/getting-启动/应用程序可移植性 [ ^ ]。







可能,你可以提高兼容性水平与 System.Windows.Forms 相比(如果你使用Qt或GTK + for .NET和Mono,则不是100%肯定,因为我没有使用最新版本的Mono)。这两个库既可以安装在Windows和Mac OS X上,也可以与.NET,Mono和MonoDevelop集成,但也可以使用Visual Studio。



缺点是:您需要在两个系统上安装其中一个库。请参阅:

http://en.wikipedia.org/wiki/GTK%2B [ ^ ],

http://www.gtk.org/ [ ^ ],

http://en.wikipedia.org/wiki/Qt_%28software%29 [ ^ ],

https://qt-project.org/ [ ^ ],

http://en.wikipedia.org/wiki/MonoDevelop [ ^ ],

http:// monodevelop.com/ [ ^ ]。



另外,您可能要等待Windows 2015将于11月到期。它承诺出色的跨平台功能,但我不太了解细节。请自行检查。



[结束编辑]



请注意,使用Linux的Mono开发,你有更少的问题。在所有情况下,您都可以使用在Mono for Windows上运行的相同应用程序。



-SA
The only way I used it to use Mono and develop using one of .NET languages. You can install Mono on Mac OS X. Mono is the alternative CLR implementation available for many platforms (see the links below).

You can start with development on .NET, if this is more convenient for you. Then you need to test it on Mono for Windows. Normally, if you have identical Mono settings and other identical components on Mac OS X, your code will work without recompilation. The major difference is between .NET and Mono (even on Windows), so it would be your major part of work addressing cross-platform issues.

Please see:
http://en.wikipedia.org/wiki/Mono_%28software%29[^],
http://www.mono-project.com/[^],
http://en.wikipedia.org/wiki/.NET_Framework[^],
http://en.wikipedia.org/wiki/CLR[^].

If you want behavior close to native Mac OS X behavior, you will need such a project as monobjc:
http://en.wikipedia.org/wiki/Monobjc,
http://www.monobjc.net/.

With it, development on Windows will be much more difficult. Still, you will be able to compile it on Windows, but you would not be able to use visual programming and — worst thing — could not test on Mono for Windows. You would need to do a big part of work on MonoDevelop:
http://en.wikipedia.org/wiki/MonoDevelop,
http://www.monodevelop.com,
http://en.wikipedia.org/wiki/Standard_Libraries_%28CLI%29#Base_Class_Library[^].

Even worse, you would need to do considerable part of it on MonoDevelop for Windows.

Alternatively, you can use System.Windows.Forms application (some incompatibilities apply, so use Mono for Windows for testing everything), but such applications look somewhat ugly and foreign on Mac OS X. System.Windows.Forms is not a part of BCL (see the like above) and is not standardized under EMCA standard for CLR. Please read on Mono portability: http://www.mono-project.com/docs/getting-started/application-portability[^].



Probably, you can improve the level of compatibility compared to System.Windows.Forms (not 100% sure because I did not work with the very latest versions of Mono) if you use Qt or GTK+ for .NET and Mono. Both libraries can be installed on both Windows and Mac OS X and are integrated with .NET, Mono and MonoDevelop, but the use of Visual Studio is also possible.

The drawback is: you would need to have the installations of one of these libraries on both systems. Please see:
http://en.wikipedia.org/wiki/GTK%2B[^],
http://www.gtk.org/[^],
http://en.wikipedia.org/wiki/Qt_%28software%29[^],
https://qt-project.org/[^],
http://en.wikipedia.org/wiki/MonoDevelop[^],
http://monodevelop.com/[^].

Also, you may want to wait for Windows 2015 which is due in November. It promises fantastic cross-platform features, but I don't know the detail well. Please check it yourself.

[END EDIT]

Note that with Mono development for Linux you have much less problem. You can use the same applications which work on Mono for Windows in all cases.

—SA


这篇关于如何在C#中在Windows上开发mac应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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