This tutorial shows how to use SharpDevelop (SD) 3.0 to compile and run Mono applications.

1.a. Download mono 1.9.0 or greater

1.b Download SharpDevelop 3.0 and download both the setup and the source zip files under the SharpDevelop 3.0 section. (beta 1 files: setup, source)

2. Install SharpDevelop. You must have .NET 3.5 installed beforehand.

3. From the source zip file, copy the samples directory onto your SharpDevelop program files directory alongside (C:\Program Files\SharpDevelop\3.0\)

4. Open the Mono folder in the samples directory you just copied over. You should find a Mono.AddIn.sln solution file. Open solution in SD.

5. Build (compile) the solution in Release configuration. (Build -> Build Solution). This step copies over the relevant files to the addins folder where SD loads its addins. (C:\Program Files\SharpDevelop\3.0\AddIns\Samples\Mono.AddIn) You do not have to copy anything in there yourself, SD does this for you.

6. Restart SD. Create a new project/solution (File -> New -> Solution). You should see Mono on the category sidebar with 3 template files (Console, Glade#, GTK#). You'll most likely just be using Console or GTK#.

7. Compile the templated solution with Mono by clicking Build Solution (Build -> Build Solution). If you click the Run (Debug -> Run) menuitem, it will be running with the .NET virtual machine, NOT mono's VM. To run using mono, follow the next few steps.

Running your application with MonoEdit

To configure your application to run under Mono's Framework,

  1. Open the project's "Debug" options (Project | Project Options | Debug)
  2. Switch the "Start Action" to "Start external program" and enter the path to the Mono executable
  3. set the "Command line arguments" to "${TargetPath}". If the path to your application's executable contains spaces put double quotes around the ${TargetPath} string as shown above.
  4. set the working directory to ${TargetDir} (without quotes for this setting).
  5. Note, you'll want to use these setting for the Release Configuration as well. In the same Debug options, change the Configuration setting (in the dropdown box) from Debug to Release and then repeat steps 1-3 here.
  6. To test that you are indeed running the Mono VM when running your program in SharpDevelop, you can follow this tutorial: Detecting the execution platform