5. Development environment (C#): Linux + Monodevelop

This chapter describes how to use the Monodevelop IDE on a Linux box to develop in C#.

Important

There is a Mono bug that prevents iFun Engine games from running on Ubuntu 16.04. Please update Mono as follows. Automatic updates are planned in future.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install mono-devel

Important

As of August 2017, iFun Engine does not support the Flatpak MonoDevelop.

5.1. Starting a new project

Enter the following in a command line to start a server project called hello:

$ funapi_initiator hello --csharp

Important

To use Monodevelop IDE, you must create a C# Project. In other words, you must use --csharp as in the example above.

5.2. Opening a project in Monodevelop

  1. Run Monodevelop.
_images/mono-1.png
  1. Click on File in the upper left, then click Open.
_images/mono-2.png
  1. There is a ‘mono’ directory that contains C# files, Go to the directory and open hello.csproj or hello.sln. (If the project name is not “hello”, open {{ProjectName}}.csproj or {{ProjectName}}.sln.)
_images/mono-3.png

Project loading has finished. When the project opens, you can begin coding.

_images/mono-4.png

5.3. Building a Project in Monodevelop

You can build without any special configuration from the Build menu or by pressing F8. You can also right-click the project to use the Build, Rebuild, and Clean features.

_images/mono-5.png

5.3.1. Run a project in Monodevelop on 7 or higher version

You have to select {project-name}-Custom Command to run a project as shown below.

_images/mono-13.png

5.3.2. Migration project with older version

Your project may not build on 7 or higher version. In this case, you can clean the project by removing a build directory({project directory}/mono/bin).

5.4. Debugging a Project in Monodevelop

To debug in Mono, you need to use the Monodevelop IDE’s Mono Soft Mode Debugger.

5.4.1. Configuring using Mono Soft Debugger

Configure settings for the MONODEVELOP_SDB_TEST environment variable to activate Mono Soft Debugger’s features. Enter the following command:

$ echo "export MONODEVELOP_SDB_TEST=1" >> ~/.profile

This is applied when you log out and then in again or when you reboot. You can check the environment variable configuration as follows:

$ echo $MONODEVELOP_SDB_TEST
1

Now, run Monodevelop to check the submenus under Run With. Then Click on the Custom Command Mono Soft Debugger menu.

_images/mono-10.png

Click Listen. Monodevelop IDE is now configured. Monodevelop IDE is now waiting for debugging.

_images/mono-11.png

Now, run the game server and open the debugger. Enter the following:

$ ./hello/mono/bin/Debug/buildcpp/hello-local --mono_debug

Debugging proceeds as follows:

_images/mono-12.png

5.4.2. Using Mono Soft Debugger on 7 or higher version

In 7 version, Mono Soft Debugger feature moved to Custom Configuration menu.

_images/mono-14.png

Click Custom Configuration menu. Then you can see Custom Command Mono Soft Debugger in the following screen

_images/mono-15.png

Important

If you can’t find Custom Command Mono Soft Debugger on the list, you may check $MONODEVELOP_SDB_TEST environment value