C# 是否可以在 Linux 上运行 Xamarin Mono?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15900963/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 18:22:32  来源:igfitidea点击:

Is it possible to run Xamarin Mono on Linux?

c#androidmonoxamarin.android

提问by rqmok

I want to know if it is possible to run Xamarin on Ubuntu. I don't like java, so I want to make Android apps with C#.

我想知道是否可以在 Ubuntu 上运行 Xamarin。我不喜欢 java,所以我想用 C# 制作 Android 应用程序。

Is a package for Ubuntu, because I haven't seen one so far?

是 Ubuntu 的一个包,因为我还没有见过一个?

Or...

或者...

Can I run Xamarin on Ubuntu using Wine?

我可以使用 Wine 在 Ubuntu 上运行 Xamarin 吗?

Or...

或者...

Is there an alternative software (with the same capabilities) that runs on Ubuntu?

是否有在 Ubuntu 上运行的替代软件(具有相同的功能)?

采纳答案by goric

Xamarin has statedon severaldifferent occasionsthat they have no plans to support Xamarin Studio on Linux in the short term. The main reasons are:

Xamarin已经表示几个不同的场合,他们没有计划支持Xamarin工作室在Linux上在短期内。主要原因是:

  • They would have to create a self-contained Mono runtime to go along with the IDE, since different flavors of Linux would ship with different Mono support
  • The cost to support many versions of Linux would outweigh the benefits
  • Lack of commercial demand to pay for support
  • 他们必须创建一个独立的 Mono 运行时与 IDE 一起使用,因为不同风格的 Linux 将提供不同的 Mono 支持
  • 支持多个 Linux 版本的成本将超过收益
  • 缺乏支付支持的商业需求

回答by ruffin

Probably worth mentioning that Miguel de Icaza (CTO of Xamarin) at least considered that Xamarin support a single distro of Linux in 2011. He's pretty approachable, and often answers questions on IRC. It might be neat to ask if they've revisited that option, even if it didn't support any sort of GUI RAD.

可能值得一提的是,Miguel de Icaza(Xamarin 的 CTO)至少在 2011 年认为Xamarin 支持 Linux 的单一发行版。他非常平易近人,经常在IRC上回答问题。即使它不支持任何类型的 GUI RAD,也可以询问他们是否重新访问了该选项。

Just as an alternative to, "No, you absolutely can't develop for Xamarin on Linux," I've often considered using MonoDevelop on Linuxto develop my faceless, shareable code. In a way, I already do something similar when I'm using my Windows laptop. You can't use Xamarin Studio to develop for iOS on Windows, so I stub out a plain console project and have it call my controllers that live in another library project. I prefer Visual Studio to Xamarin Studio (and am using Starter & Indie licenses, so I can't use Xamarin for Visual Studio), so I like to do faceless development on Windows. Then, when I'm "done" with (ie, ready to take a break from) the faceless dev, I head over to Xamarin Studio on OS X to hook things up to the iOS UI stubs I made there.

作为“不,你绝对不能在 Linux 上为 Xamarin 开发”的替代方案,我经常考虑在 Linux上使用MonoDevelop来开发我的匿名、可共享的代码。在某种程度上,当我使用 Windows 笔记本电脑时,我已经做了类似的事情。您不能使用 Xamarin Studio 在 Windows 上为 iOS 进行开发,所以我存根了一个普通的控制台项目,并让它调用我的控制器,该控制器位于另一个库项目中。与 Xamarin Studio 相比,我更喜欢 Visual Studio(并且我使用的是 Starter 和 Indie 许可证,所以我不能将Xamarin 用于 Visual Studio),所以我喜欢在 Windows 上进行匿名开发。然后,当我“完成”(即准备好休息)匿名开发人员时,我前往 OS X 上的 Xamarin Studio 将事情连接到我在那里制作的 iOS UI 存根。

It'd be easy enough to do that on Linux "for Android", and only use Windows or OS X when you develop your UI and create your distributable. Admittedly, the UI is usually a ton of code (always more than I expect, at least), but you could easily get away with good, well-factored libs developed on Linux for let's say half of your coding or more. And it forces you to separate your concerns nicely, which I always appreciate.

在“Android 版”Linux 上执行此操作很容易,并且仅在开发 UI 并创建可分发的时才使用 Windows 或 OS X。诚然,用户界面通常是大量代码(至少总是比我预期的要多),但是您可以轻松地使用在 Linux 上开发的良好、精心设计的库,假设您的编码有一半或更多。它迫使你很好地分离你的关注点,我一直很感激。

EDIT:I feel someone should point out that Mono-qua-Mono does run on Linux already. It's just the Xamarin stuff -- the glue to the more popular consumer platforms -- that isn't on Linux. So you can run XamarinMono on Linux just fine right now, and have been able to longer than Xamarin's been "a thing". ;^)

编辑:我觉得有人应该指出Mono-qua-Mono 已经在 Linux 上运行了。这只是 Xamarin 的东西——更流行的消费者平台的粘合剂——不在 Linux 上。因此,您现在可以在 Linux 上运行XamarinMono 就好了,并且已经能够比 Xamarin 运行的时间更长。;^)

回答by Shane J

There are a couple steps you need to follow to build Xamarin.Android apps on Ubuntu.

在 Ubuntu 上构建 Xamarin.Android 应用程序需要遵循几个步骤。

  1. Install the alpha version of mono (currently 5.8), directions are on their site(also reinstall mono-complete after adding the ppa key).
  2. Follow the instructions at the following repo: https://github.com/xamarin/xamarin-android
  1. 安装 mono 的 alpha 版本(当前为 5.8),说明在他们的网站上(在添加 ppa 密钥后也重新安装 mono-complete)。
  2. 按照以下存储库中的说明进行操作:https: //github.com/xamarin/xamarin-android

It's a slow process and downloads its own temporary NDK and other things, but it should work.

这是一个缓慢的过程,下载自己的临时 NDK 和其他东西,但它应该可以工作。