在 Windows 上使用 Mono

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

Using Mono on Windows

c#windowsmono

提问by John

I know it sounds stupid but:

我知道这听起来很愚蠢,但是:

I've found thisapplication written on Mono and it is open source.

我发现这个应用程序是用 Mono 编写的,它是开源的。

While peeking at the source code I've found this two "using" directive that stoped me:

在查看源代码时,我发现这两个“使用”指令阻止了我:

using Gdk;

using Mono.Unix;

I guess they're Mono specific libraries.

我猜他们是 Mono 特定的库。

So, it is possible to run Mono under Windows? ( perhaps Visual Studio express edition ? )

那么,可以在 Windows 下运行 Mono 吗?(也许是 Visual Studio 速成版?)

I'm trying to learn C#

我正在努力学习 C#

I see there is a Windows branch of the app, but it is empty.

我看到该应用程序有一个 Windows 分支,但它是空的。

BTW: Is it Mono thought for cross platform in first place?

顺便说一句:首先是 Mono 考虑跨平台吗?

EDIT

编辑

I've downloaded/installed and run the sample code

我已经下载/安装并运行示例代码

using Mono.Unix;

class X { static void Main () { System.Console.Write("OK");} } 

And the answer to my own question is:

我自己的问题的答案是:

x.cs(1,12): error CS0234: The type or namespace name `Unix' does not exist 
in the namespace `Mono'. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings

No, it doesn't work :(

不,它不起作用:(

采纳答案by Serapth

Mono on windows guide

Windows 上的 Mono 指南

I am not sure you will be able to use code using the Mono.Unix namespace, but generally if you are creating cross platform code, you shouldn't have to.

我不确定您是否能够使用使用 Mono.Unix 命名空间的代码,但通常如果您要创建跨平台代码,则不必这样做。

Gnome Do linux port. For a learning project however, I might suggest starting with code that is actually cross platform, or develop on Linux for now. Tackling cross platform issues and possibly an incomplete port will just complicate the learning process.

Gnome 做 linux 端口。但是,对于学习项目,我可能建议从实际跨平台的代码开始,或者暂时在 Linux 上开发。解决跨平台问题和可能的不完整端口只会使学习过程复杂化。

So, I suppose in summary to your initial question. Yes, you can run Mono on Windows, but it is possible to write platform specific code, which the example application you have chosen has indeed done. The link I provided above is a port to make that code work on Windows. Without porting ( changing the platform specific code ), that program will not compile on windows.

所以,我想总结一下你最初的问题。是的,您可以在 Windows 上运行 Mono,但可以编写特定于平台的代码,您选择的示例应用程序确实做到了这一点。我上面提供的链接是使该代码在 Windows 上工作的端口。如果不移植(更改平台特定代码),该程序将无法在 Windows 上编译。

回答by cyberconte

Yes, you can install mono under windows. There is an experimental installer.

是的,你可以在windows下安装mono。有一个实验安装程序。

See: http://mono-project.com/Mono:Windows

请参阅:http: //mono-project.com/Mono: Windows

That page also has information on the gtk libs.

该页面还包含有关 gtk 库的信息。

回答by Blake Pettersson

Of course you can run mono under windows:

当然你可以在windows下运行mono:

http://www.go-mono.com/mono-downloads/download.html

http://www.go-mono.com/mono-downloads/download.html

回答by dmitry_vk

The Gdk is a cross-platform library for low-level windowing system stuff, and the code is using .NET binding to Gdk. It is available for windows (as a part of Gtk# package or in Mono installer).

Gdk 是用于低级窗口系统内容的跨平台库,代码使用 .NET 绑定到 Gdk。它可用于 windows(作为 Gtk# 包的一部分或在 Mono 安装程序中)。

Mono.Unix is a mono library that provides access to unix services (syscalls, stdlib). I do not think that Mono.Unix is available for windows, but Mono.Posix might be available.

Mono.Unix 是一个提供对 unix 服务(系统调用、stdlib)的访问的单声道库。我不认为 Mono.Unix 可用于 Windows,但 Mono.Posix 可能可用。