编译基于C#的Windows(WinForms App)应用程序以在Mac OS High Sierra或Mojave上运行 [英] Compile C# based Windows (WinForms App) application to run on Mac OS High Sierra or Mojave

查看:173
本文介绍了编译基于C#的Windows(WinForms App)应用程序以在Mac OS High Sierra或Mojave上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用C#在Windows上构建了一个(Windows Forms App)应用程序.现在,我想在不更改应用程序的情况下将整个项目/应用程序定位到mac OS.有什么简单的方法可以实现吗?我不想在MAC上从头开始重建整个应用程序.我不想在MAC上使用虚拟机...我有Visual Stuido 2017和成对的MAC.但是,我在这里迷路了.

I have built an (Windows Forms App) application on Windows in C#. Now, I would like to target this whole project / application to mac OS without changing the application. Is there any easy way to achieve it? I don't want to rebuild the entire app from scratch on MAC. I don't want to use virtual machine on MAC... I have Visual Stuido 2017 and a paired MAC. But, I'm lost here.

推荐答案

; TLDR WinForms MonoDevelop IDE进行开发.

;TLDR Mono, using WinForms and MonoDevelop IDE for development.

.NET Framework 是完整的实现,包括所有内容,但只能在Windows上运行.

.NET Framework is the full implementation that includes everything but runs only on Windows.

.NET Core 是.Net框架的较新的OpenSource实现,但不包括WPF/WinForms-因为它们严重依赖DirectX/GDI,因此它们实际上仅是Windows.

.NET Core is the newer OpenSource implementation of .Net framework but doesn't include WPF/WinForms - because those rely heavily on DirectX/GDI essentially making them Windows only.

Xamarin .基于Mono框架的Xamarin进一步向iOS和Android分支.有一个Xamarin Mac,但它支持与Mono相同的基于GTK#的UI工具包.还有一个WinForms等效的UI工具包,也称为

Xamarin. Xamarin based off of Mono framework branched more towards iOS and Android. There is a Xamarin Mac but it supports the same GTK# based UI toolkit as Mono.There is a WinForms equivalent UI toolkit as well called Xamarin Forms but it is mobile only (iOS, Android & Universal Windows Platform)

单声道.Mono是.Net框架的开源实现,默认情况下,UI使用GTK#.在所有Windows,Linux,macOS上都能正常运行.在包括Windows在内的所有操作系统上使用GTK#作为基础UI工具包.

Mono. Mono is OpenSource implementation of .Net framework, uses GTK# by default for UI. Does run fine on all of Windows, Linux, macOS. Uses GTK# as underlying UI toolkit on all OSes including Windows.

什么是跨平台?有一个称为 .NET标准库的基类库的子集-以及编译器平台,只有.Net的这些子集是真正的跨平台.

What's Cross Platform? There is a subset of Base Class Library, called .NET Standard Library - as well as the compilers platform, only these subsets of .Net are truly cross-platform.

总而言之,但是,Mono在Linux和Amp上均支持 Windows窗体.苹果系统.除了一些极端的情况,它工作得很好.但是,UI外观仅Windows.就像在WINE下运行Windows应用程序一样.默认的Mono IDE为 MonoDevelop .

To sum it up, Mono does however support Windows Forms on both Linux & macOS. Except some corner cases it works very well. However the UI look and feel is Windows only. It is like running Windows applications under WINE. Default Mono IDE is MonoDevelop.

Xamarin Mac 非常适合您要编写新应用程序的情况Xamarin Mac从头开始提供了完整的macOS SDK,并提供了自己的IDE(Xamarin Studio).

Xamarin Mac is great if you want to write a new application from scratch since Xamarin Mac exposes you full macOS SDK and offers its own IDE (Xamarin Studio).

不过,根据您的情况,Mono是最佳选择.安装了mono后,您甚至可以尝试从终端以 mono appName 的形式运行当前应用.即使路径和其他资源损坏,它也应呈现UI.

In your situation though, Mono is best option. After having installed mono you can even try running your current app as mono appName from terminal. It should render the UI even if the paths and other resources are broken.

更新2021

WPF和WinForms现在是开源的,并且是.Net Core(现在称为 .Net .Core的名称已被删除)的一部分.以前的经典.Net现在称为.Net框架.WPF/WinForms的新功能增强功能仅适用于.Net.尽管这些仍然仅是Windows,并且将保持不变.

WPF and WinForms now are open source and part of .Net Core (which now is referred to as .Net. Core is dropped in name). The previous classic .Net is now called .Net framework. New WPF/WinForms features enhancements are on available for .Net only. Though these still are Windows only and will stay so.

Avalonia UI框架

Avalonia UI Framework and Uno Platform are newer .Net Core (AKA .Net) based cross-platform solutions. Both use XAML. Avalonia is more like WPF while Uno tries to be cross-platform UWP.

这篇关于编译基于C#的Windows(WinForms App)应用程序以在Mac OS High Sierra或Mojave上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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