views:

232

answers:

1

Hi there, I have a C# library (DLL)

//  ProgramLib.cs //
using System;

namespace ProgramLibrary
{
    public class Lib
    {
        public Lib()
        {
            Console.WriteLine("Lib Created");
        }
    }
}

And I have the following console program

//  Program.cs //
using System;
using ProgramLibrary;

class MainClass
{
    public static void Main (string[] args)
    {
        ProgramLibrary.Lib lib = new ProgramLibrary.Lib();
    }
}

In a linux environment, if both files reside in the same directory

What is the Mono compiler (mcs) command that compiles Program.cs with reference to ProgramLib.cs?

Thanks all!!

+3  A: 

First compile ProgramLib to ProgramLib.dll, then reference it:

$ gmcs -t:library ProgramLib.cs
$ gmcs -r:ProgramLib.dll Program.cs
Jon Skeet
thanks Jon! very helpful as per
divinci