Net Mono For Mac

Posted onby admin

Yesterday I decided to install Mono onto my MacBook to enable .NET development. Below I have listed the steps I took to accomplish compiling and running a Windows Forms hello world style application and packing it into an app bundle so I can run it by double clicking the icon.

  1. Net Mono For Mac Osx
  2. Net Mono For Mac High Sierra
  3. .net Mono Mac

The reasons for doing this are twofold;

Getting Mono Running The labs in this chapter will guide you through obtaining, installing, and setting up Mono for Linux, Windows, and Mac OS X. The Mono system - Selection from Mono: A Developer's Notebook Book. After VS for MAC updates I cannot build certain projects anymore. Error: The primary reference 'Splat' could not be resolved because it was built against the '.NETPortable,Version=v5.0' framewo. Mono is a free and open-source project to create an Ecma standard-compliant.NET Framework-compatible software framework, including a C# compiler and a Common Language Runtime.Originally by Ximian, it was later acquired by Novell, and is now being led by Xamarin, a subsidiary of Microsoft and the.NET Foundation.The stated purpose of Mono is not only to be able to run Microsoft.NET. Mono Framework更新来啦,这是一个使开发人员能够轻松地创建.NET Foundation的跨平台应用程序。提供了.NET Framework程序在其他平台上运行的支持。本站提供Mono Framework for mac免费版下载,安装方便,可以永久使用!! Mono Framework Mac版安装教程.

* I spend most of my time at work professionally developing .NET applications using Visual Studio, so obviously I'm interested in using .NET also on the Mac.

* I'm thinking of writing an experimental Push Notification Service backend in .NET and would rather avoid having to launch Windows to do this.

Requirements

Net mono for mac high sierra

Leopard (Supposedly works on Tiger as well, but then you need to install X11 to make Windows Forms applications work)

Installation

1. Get Mono for Mac from the Mono Project website. I grabbed version 2.4, the latest stable version as of this article's publication.

2. Run the installer. Mono installs under '/Library/Frameworks/Mono.framework'.

Net Mono For Mac Osx

Hello World on the command line

3. Compile a command line hello world tool:

hello.cs file contents

Compile using the 'gmcs hello.cs' terminal command.

4. Run using the 'mono hello.exe' terminal command. The 'Hello Mono World' message should be printed.

Net Mono For Mac

Windows Forms Hello World

5. Compile a Windows Forms hello world app tool.

helloforms.cs file contents

Mono

Compile using 'gmcs helloforms.cs /r:System.Windows.Forms.dll'.

6. Run using the 'mono helloforms.exe' terminal command, and if all is well a message box should be displayed.

Creating an app bundle

7. Use MacPack to package the .NET assembly into an app bundle, which can be launched from the Finder.

Net Mono For Mac

'macpack -n:HelloForms -a:helloforms.exe -o:. -m:winforms' on the command line.

8. Launch the app bundle HelloForms.app from the Finder to make sure it works.

That's it really. You are now ready to start development on your enterprise level .NET project using Mono on your Mac.

Mac

Net Mono For Mac High Sierra

Additional tips

* MacPack has a really good man page documenting its use.

http://linux.die.net/man/1/macpack, or just 'man macpack' on the command line.

* Simplified compilation using pkg-config

Note that using pkg-config (see if it's setup on your system by running 'pkgconfig' on the command line) you can compile the forms app using 'gmcs helloforms.cs -pkg:dotnet' instead. Not a big difference in this example, but not having to list all needed assemblies will help when compiling more complex projects.

For .NET 3.5 compatibility, you would use the -pkg:dotnet35.

To set it up, add the following line to the '~/.bash_profile' file, if the file does not exist create it:

.net Mono Mac

References

Windows.Forms and Mac OS/X
http://oepapel.blogspot.com/2005/04/windowsforms-and-mac-osx.html

Mono Basics
http://mono-project.com/Mono_Basics

Customizing Terminal when Compiling Mono apps
http://dotmac.rationalmind.net/2008/12/customizing-terminal-when-compiling-mono-apps/

Archive for the 'firefox' Category
(contains info about pkg-config)
http://wp.colliertech.org/cj/?cat=9