如何从 OSX 中的终端 运行 Windows.Forms C# 程序?
How to run a Windows.Forms C# program from Terminal in OSX?
我在学校的 C# 课程中必须使用 System.Windows.Forms,但我有一本 Mac 书,但 Visual Studio 说它不存在。我读到如果我安装 Mono 然后使用 mcs hello.cs -pkg:dotnet
从终端编译和 运行 它就可以使用 WinForms。 "hello.cs" 只是一个使用 System.Windows.Forms 的 Hello World 程序......它编译但是当我做 mono hello.exe
它说:
WARNING: The Carbon driver has not been ported to 64bits, and very few
parts of Windows.Forms will work properly, or at all
...然后是一堆东西,我会把它留在这里 pastebin!
在OSX | Mono 网站他们说为了使用 Windows.Forms Mono 的体系结构必须是 32 位并且要更改它我必须做:mono --arch=32
但是当我这样做时,它似乎没有做任何事情并且如果我编译它并再次 运行 "hello.exe" 它会打印我之前提到的相同内容。
请帮帮我!我的 Mac 很旧,运行 宁 Windows 不是一个选项。
使用较旧的 mcs
编译器编译 hello.cs
代码:
/Library/Frameworks/Mono.framework/Commands/mcs -pkg:dotnet ./hello.cs
或者使用较新的基于 Rosyln 的 csc
编译器:
/Library/Frameworks/Mono.framework/Commands/csc ./hello.cs
Microsoft (R) Visual C# Compiler version 2.3.1.61919 (57c81319)
Copyright (C) Microsoft Corporation. All rights reserved.
运行 它与 mono
和 --arch=32
选项:
/Library/Frameworks/Mono.framework/Commands/mono --arch=32 ./hello.exe
或使用mono32
:
/Library/Frameworks/Mono.framework/Commands/mono32 ./hello.exe
我在学校的 C# 课程中必须使用 System.Windows.Forms,但我有一本 Mac 书,但 Visual Studio 说它不存在。我读到如果我安装 Mono 然后使用 mcs hello.cs -pkg:dotnet
从终端编译和 运行 它就可以使用 WinForms。 "hello.cs" 只是一个使用 System.Windows.Forms 的 Hello World 程序......它编译但是当我做 mono hello.exe
它说:
WARNING: The Carbon driver has not been ported to 64bits, and very few
parts of Windows.Forms will work properly, or at all
...然后是一堆东西,我会把它留在这里 pastebin!
在OSX | Mono 网站他们说为了使用 Windows.Forms Mono 的体系结构必须是 32 位并且要更改它我必须做:mono --arch=32
但是当我这样做时,它似乎没有做任何事情并且如果我编译它并再次 运行 "hello.exe" 它会打印我之前提到的相同内容。
请帮帮我!我的 Mac 很旧,运行 宁 Windows 不是一个选项。
使用较旧的 mcs
编译器编译 hello.cs
代码:
/Library/Frameworks/Mono.framework/Commands/mcs -pkg:dotnet ./hello.cs
或者使用较新的基于 Rosyln 的 csc
编译器:
/Library/Frameworks/Mono.framework/Commands/csc ./hello.cs
Microsoft (R) Visual C# Compiler version 2.3.1.61919 (57c81319)
Copyright (C) Microsoft Corporation. All rights reserved.
运行 它与 mono
和 --arch=32
选项:
/Library/Frameworks/Mono.framework/Commands/mono --arch=32 ./hello.exe
或使用mono32
:
/Library/Frameworks/Mono.framework/Commands/mono32 ./hello.exe