在 Visual Studio 中使用 C# 或 VB 创建适用于 Mac、Windows 或 iOS 的桌面应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15175031/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Creating desktop application for Mac, Windows or iOS using C# or VB in Visual Studio
提问by yadavr
Can i create application in visual studio that can be run on Mac, windows and iOS? My client asked me to create a line of business application that can be run on Mac, Windows or iOS through one click installation, and his precious application was developed as a Windows application in C#, that currently runs only on windows. I have seen xamarin, is any other option? Any help or suggestion would be greatly appreciated. Thanks.
我可以在 Visual Studio 中创建可以在 Mac、Windows 和 iOS 上运行的应用程序吗?我的客户要求我创建一个可以通过一键安装在 Mac、Windows 或 iOS 上运行的业务应用程序,而他宝贵的应用程序是用 C# 开发的 Windows 应用程序,目前只能在 Windows 上运行。我见过 xamarin,还有其他选择吗?任何帮助或建议将不胜感激。谢谢。
采纳答案by MusiGenesis
回答by Anoop Vaidya
You can create a web-application, which are machine, architecture independent.
您可以创建一个独立于机器、体系结构的 Web 应用程序。
Or you need to create two different platform application for Windows and one for Mac OSX, both sharing same database stored in some server or any kind of machine.
或者您需要为 Windows 创建两个不同平台的应用程序,一个为 Mac OSX 创建一个不同的平台应用程序,它们共享存储在某个服务器或任何类型机器中的相同数据库。
回答by moxy
Yes and NO ;)
是和否;)
it's possible (and brand new) through Visual Studio and Mono (as far as I understood it is an open source implementation of .NET) but you will still need a mac to compile the iOS / OSX versions, an iPhone/iPad/iPod touch to test on device, etc.
通过 Visual Studio 和 Mono(据我所知,它是 .NET 的开源实现)是可能的(并且是全新的),但您仍然需要一个 mac 来编译 iOS/OSX 版本,一个 iPhone/iPad/iPod touch在设备上进行测试等。
Honestly, I would go with creating an OSX app, iOS app and Windows app separately. Willing to do everything at once is nice (and often a cost question) but it is not a real option (unless cost is the major concern).
老实说,我会分别创建 OSX 应用程序、iOS 应用程序和 Windows 应用程序。愿意一次做所有事情很好(通常是一个成本问题),但这不是一个真正的选择(除非成本是主要问题)。
Even between iOS and OSX there are numerous differences, different concepts (option to have multiple windows on OSX / only one in iOS, different API even for common stuff, the "touch" of an iOS app will make you work differently, screen size will make you think of different functionalities or not all would fit in the iOS app). "UserFriendlyness" is a thing to take into account. a windows user and a mac user are not used to same interface, same application concepts, gestures on phones or trackpads, mac apps are generally not using the (F1,F2, etc. keys), etc.
即使在 iOS 和 OSX 之间也有许多差异,不同的概念(在 OSX 上有多个窗口的选项/在 iOS 中只有一个,即使是常见的东西也有不同的 API,iOS 应用程序的“触摸”会让你工作不同,屏幕大小会让您想到不同的功能或并非所有功能都适合 iOS 应用程序)。“用户友好性”是需要考虑的事情。windows用户和mac用户不习惯相同的界面,相同的应用程序概念,手机或触控板上的手势,mac应用程序通常不使用(F1,F2等键)等。
There are stuff like phoneGap (ok not the desktop part of your question) that says everything works on all phones but it does not benefit of the advantages of a plateform, it goes to the lower common denominator, meaning that your app is often less efficient than if made natively.
有像 phoneGap 这样的东西(好吧不是你问题的桌面部分),它说一切都适用于所有手机,但它并没有受益于平台的优势,它降低了公分母,这意味着你的应用程序通常效率较低比如果是本土制造的。
Even more hazardous, you inherit from bugs of these tools, and some can be really tricky to understand (is there a problem in my code, in phoneGap/xamarin ?) and you could loose much time on stuff like these.
更危险的是,您从这些工具的错误继承而来,有些可能真的很难理解(我的代码中是否有问题,在 phoneGap/xamarin 中?)并且您可能会在这些东西上浪费很多时间。
In the end it's just a matter of cost.
归根结底只是成本问题。
Even Excel from Microsoft is different between OSX and Windows plateforms, they even fixed a bug in excel 2011 for mac, that is still present in windows versions ;) (they have different business units if I remember correctly)
即使来自 Microsoft 的 Excel 在 OSX 和 Windows 平台之间也有所不同,他们甚至修复了 excel 2011 for mac 中的一个错误,该错误仍然存在于 Windows 版本中;)(如果我没记错的话,它们有不同的业务部门)
So yes, business logic, but mac apps is not only objective-C, you can import/work with C or C++ files in Xcode.
所以是的,业务逻辑,但 mac 应用程序不仅是 Objective-C,您还可以在 Xcode 中导入/使用 C 或 C++ 文件。
just my 2 cents.
只是我的 2 美分。
回答by Karl-Johan Sj?gren
As MusiGenesis suggested, Monowould probably do the trick for you. You will still need Xamarin's MonoTouchfor iOS support but if you separate your business-logic to a separate assembly that could easily be reused.
正如 MusiGenesis 所建议的那样,Mono可能会为您解决问题。您仍然需要Xamarin 的 MonoTouch来支持 iOS,但是如果您将业务逻辑分离到一个可以轻松重用的单独程序集。
You might also want to consider making two different projects for the desktop editions, one with MonoMacand one with WPF (for Windows) to give your users a better experience but still with the actual logic in a separate assembly that you can reuse for all platforms.
您可能还想考虑为桌面版制作两个不同的项目,一个使用MonoMac,一个使用 WPF(适用于 Windows),以便为您的用户提供更好的体验,但仍将实际逻辑放在一个单独的程序集中,您可以在所有平台上重复使用.