在 Windows 上进行 Mono 开发的最佳设置是什么?

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

What's the best setup for Mono development on Windows?

windowsmono

提问by Chris Farmer

I started trying to play with Mono, mostly for fun at the moment. I first tried to use the Visual Studio plugin that will convert a csproj into a makefile, but there seemed to be no version available for Visual Studio 2005. I also read about the MonoDevelop IDE, which sounded nice. Unfortunately, there's no pre-fab Windows package for it. I tried to follow some instructions to build it by combining dependencies from other semi-related installs. It didn't work, but that's probably because I'm a Windows-oriented guy and can barely spell "makefile".

我开始尝试使用 Mono,目前主要是为了好玩。我首先尝试使用将 csproj 转换为 makefile 的 Visual Studio 插件,但似乎没有适用于 Visual Studio 2005 的版本。我还阅读了 MonoDevelop IDE,这听起来不错。不幸的是,它没有预制的 Windows 包。我尝试按照一些说明通过结合其他半相关安装的依赖项来构建它。它没有用,但这可能是因为我是一个面向 Windows 的人,几乎不会拼写“makefile”。

So, my question is this: What's the lowest-energy way to get up and running to try some Mono-based development on Windows?

所以,我的问题是:在 Windows 上尝试一些基于 Mono 的开发的最低能耗方式是什么?

采纳答案by Dillie-O

I'd recommend getting VMWare Player and using the free Mono development platform image that is provided on the website.

我建议获取 VMWare Player 并使用网站上提供的免费 Mono 开发平台映像。

Download Mono

下载单声道

Setup time for this will be minimal, and it will also allow you to get your code working in .NET and then focus on porting issues without a massive hassle of switching machines and the like. the VMWare Player tools will allow you to simply drag and drop the files over to copy them.

这样做的设置时间将是最少的,并且它还允许您让您的代码在 .NET 中工作,然后专注于移植问题,而无需切换机器等。VMWare Player 工具将允许您简单地拖放文件来复制它们。

I'm looking to take a couple of my .NET apps and make them Mono compliant, and this is the path I'm going to take here shortly.

我希望采用我的几个 .NET 应用程序并使它们符合 Mono,这就是我很快将要采用的路径。

回答by Kris Erickson

A year later and the answer to this has change greatly. You can now use MonoDevelopon Windows, or if you are more comfortable in Visual Studio you can use the Visual Studio Toolsto write everything and then debug on in VM to make sure it is working on Linux.

一年后,这个问题的答案发生了很大的变化。您现在可以在 Windows 上使用MonoDevelop,或者如果您更习惯使用 Visual Studio,您可以使用Visual Studio 工具编写所有内容,然后在 VM 中调试以确保它在 Linux 上运行。

回答by Luke

@Chris I have found that Visual Studio is the best IDE for developing against .NET -- I think the best way to target Mono is really just to develop and build in Visual Studio under Windows then just run those binaries directly on Linux (or whatever other Mono platform you are using). There are free versions of Visual Studio if licensing is a concern. If you are developing under Linux, the best software is probably Eclipse with a Mono plugin (see The Mono Handbook - Eclipsefor installation instructions) but keep in mind it doesn't have near the amount of features or language integration Visual Studio has.

@Chris 我发现 Visual Studio 是针对 .NET 进行开发的最佳 IDE——我认为针对 Mono 的最佳方法实际上只是在 Windows 下的 Visual Studio 中进行开发和构建,然后直接在 Linux 上运行这些二进制文件(或其他任何您正在使用的其他 Mono 平台)。如果需要考虑许可问题,可以使用 Visual Studio 的免费版本。如果您在 Linux 下进行开发,最好的软件可能是带有 Mono 插件的Eclipse(有关安装说明,请参阅The Mono Handbook - Eclipse),但请记住,它没有 Visual Studio 所具有的大量功能或语言集成。

@modesty Mono is a 3rd party open source implementation of the .NET framework which allows you to run .NET applications on platforms other than Windows.

@modesty Mono 是 .NET 框架的第 3 方开源实现,它允许您在 Windows 以外的平台上运行 .NET 应用程序。

回答by denis phillips

One of the best things you can do if developing with Visual Studio for Mono is to get MoMA http://www.mono-project.com/MoMA. This will inspect any number of assemblies that you build and generate a report showing potential Mono problems (e.g., methods not implemented in the mono library). It can be run from a GUI or the command line for use in automated builds.

如果使用 Visual Studio for Mono 进行开发,您可以做的最好的事情之一就是获得 MoMA http://www.mono-project.com/MoMA。这将检查您构建的任意数量的程序集并生成显示潜在 Mono 问题的报告(例如,未在 Mono 库中实现的方法)。它可以从 GUI 或命令行运行,用于自动构建。

回答by Kris Erickson

Miguel had a post about debugging Mono running on linux with remote debugging on Visual Studio. This may be something you want to look into... Using Visual Studio to debug Mono. There is also a new project called CloverLeafwhose goal is enabling debugging Mono on Windows in Visual Studio.

Miguel 发表了一篇关于在 Visual Studio 上使用远程调试调试在 Linux 上运行的 Mono 的帖子。这可能是您想要研究的内容... 使用 Visual Studio 调试 Mono。还有一个名为CloverLeaf的新项目,其目标是在 Visual Studio 中启用 Windows 上的 Mono 调试。

回答by apenwarr

There's just no reason to buildyour app using Mono; the whole point of the .Net CLR is that the compiled output is cross-platform.

没有理由使用 Mono构建您的应用程序;.Net CLR 的全部意义在于编译后的输出是跨平台的。

So you can simply build it using your favourite IDE (and if you like IDEs, Microsoft's is the best one to use) and then testit on Mono. Even if you get Mono working on Windows, it wouldn't be a very good test of your app's portability: what if your app does silly things like assuming filenames have backslashes in them, or that there's something special about a folder called Program Files? The best way to do portability testing is to actually test your app on the target platform.

因此,您可以简单地使用您最喜欢的 IDE(如果您喜欢 IDE,Microsoft 的 IDE 是最好的)来构建它,然后在 Mono 上对其进行测试。即使您让 Mono 在 Windows 上运行,它也不会很好地测试您的应用程序的可移植性:如果您的应用程序做了一些愚蠢的事情,例如假设文件名中有反斜杠,或者名为 Program Files 的文件夹有什么特别之处怎么办?进行可移植性测试的最佳方法是在目标平台上实际测试您的应用程序。

And that's pretty easy to do with a Linux VMware player like the one at http://www.go-mono.com/mono-downloads/download.html.

使用 Linux VMware 播放器(如http://www.go-mono.com/mono-downloads/download.html 中的播放器)非常容易做到这一点。

回答by Dan Rosenstark

Personally, I'm just compiling in Visual Studio 2008 as if it were for .Net 2.0 and then running in Mono (VS2008 on Windows in a VirtualBox, Mono on OSX). All the problems come up at runtime, anyway, so the system works perfectly.

就我个人而言,我只是在 Visual Studio 2008 中进行编译,就好像它是针对 .Net 2.0 一样,然后在 Mono 中运行(在 VirtualBox 中的 Windows 上运行 VS2008,在 OSX 上运行 Mono)。无论如何,所有问题都会在运行时出现,因此系统运行良好。

I just found this very new link, which is amazing and shows you how to set up Visual Studio 2008 for Mono.

我刚刚发现了这个非常新的链接,它很棒,它向您展示了如何为 Mono 设置 Visual Studio 2008。

At the same time, setting up Mono on OpenSuse or Ubuntu inside a VirtualBox(Sun's product) is easy, painless, and doesn't force you to abandon whatever platform you normally live in.

同时,在 VirtualBox(Sun 的产品)内的 OpenSuse 或 Ubuntu 上设置Mono既简单又轻松,并且不会强迫您放弃通常使用的任何平台。

This is not relevant to your question, but I might note that I just got into Mono and I'm amazed at how much of .Net is implemented, including much of the Winforms stuff.

这与您的问题无关,但我可能会注意到我刚刚进入 Mono,我对 .Net 的实现程度感到惊讶,包括 Winforms 的大部分内容。

回答by skolima

Eclipse plugin for Mono is dead. On Linux use MonoDevelopor X-Developif you like good commercial support (although MonoDevelop is closing on them fast feature-wise). On Windows SharpDevelophas custom MSBuild targets for compiling the code against Mono.

Mono 的 Eclipse 插件已死。在 Linux 上,如果您喜欢良好的商业支持,请使用MonoDevelopX-Develop(尽管 MonoDevelop 正在快速关闭它们)。在 Windows 上,SharpDevelop具有自定义 MSBuild 目标,用于针对 Mono 编译代码。

As Mono and MonoDevelop are changing fast, be sure to use the latest released versions, even if they are not marked as stable yet (e.g. versions shipped with stock Ubuntu are terribly outdated).

因为 Mono 和 MonoDevelop 变化很快,所以一定要使用最新发布的版本,即使它们还没有被标记为稳定版(例如,与股票 Ubuntu 一起发布的版本已经过时了)。

The VMWare image is a great way to start testing Windows-developed code on Linux. Don't touch cygwin unless you are already very conformable with it.

VMWare 映像是在 Linux 上开始测试 Windows 开发代码的好方法。除非您已经非常适应 cygwin,否则不要接触它。

回答by UberAlex

My first instinct would be the rather unhelpful "Install Linux". You are somewhat swimming against the currentto try and develop in mono under windows. Installing GTK and everything is a bit of a bother in my experience.

我的第一直觉是相当无用的“安装 Linux”。你有点逆流而行,试图在 windows 下用单声道开发。根据我的经验,安装 GTK 和一切都有些麻烦。

If you do feel like using linux, then you could Try Ubuntu

如果你确实喜欢使用 linux,那么你可以试试 Ubuntu

Otherwise:

除此以外:

There's some information here: http://www.mono-project.com/Mono:Windowsand it seems the cygwintoolchain might be your best bet. I don't think you're going to be able to avoid makefiles, sadly. I found a slightly more explicit tutorial from O'Reilly.

这里有一些信息: http://www.mono-project.com/Mono:Windows看来cygwin工具链可能是您最好的选择。可悲的是,我认为您无法避免生成文件。我从O'Reilly找到了一个更明确的教程。

@modesty:

@谦虚:

Mono provides the necessary software to develop and run .NET client and server applications on Linux, Solaris, Mac OS X, Windows, and Unix. Sponsored by Novell (http://www.novell.com), the Mono open source project has an active and enthusiastic contributing community and is positioned to become the leading choice for development of Linux applications.
Mono 提供了在 Linux、Solaris、Mac OS X、Windows 和 Unix 上开发和运行 .NET 客户端和服务器应用程序所需的软件。Mono 开源项目由 Novell ( http://www.novell.com)赞助,拥有活跃且热情的贡献社区,并有望成为 Linux 应用程序开发的首选。
-- 来自 Mono 网站。

回答by Chris Farmer

I liked the idea of trying to use MonoDevelop mostly just to make sure my stuff would work against the Mono runtimes. I guess it would also be possible to get crazy with msbuild and write some custom targets that tried to build against Mono, but that's basically emulating the now-defunct plug-in's functionality which I assume was non-trivial to build. I do have minor experience with cygwin, and I am happy typing "configure" and "make" all day long, but when a problem occurs in that process, I'm virtually screwed. I'll probably try to play with all this again, but if it takes me more than a couple hours to come up with a way to build comfortably against the Mono runtimes, I'll probably just bail.

我喜欢尝试使用 MonoDevelop 的想法,主要是为了确保我的东西可以在 Mono 运行时运行。我想也有可能对 msbuild 变得疯狂并编写一些试图针对 Mono 构建的自定义目标,但这基本上是在模拟现已不复存在的插件的功能,我认为构建这些功能并非易事。我确实对 cygwin 有一些小经验,我很高兴整天输入“configure”和“make”,但是当在这个过程中出现问题时,我几乎被搞砸了。我可能会再次尝试使用所有这些,但是如果我需要花费几个小时以上的时间来想出一种针对 Mono 运行时轻松构建的方法,我可能会放弃。

I will try the Eclipse idea. I use that for Java, so I might be able to get the c# stuff to work. We shall see...

我会尝试 Eclipse 的想法。我将它用于 Java,所以我也许可以让 c# 的东西工作。我们会看到...