14

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?

1 Answer 1

30

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

$ gmcs -t:library ProgramLib.cs $ gmcs -r:ProgramLib.dll Program.cs 
Sign up to request clarification or add additional context in comments.

2 Comments

Anybody knows if there is a way to do this as a one liner?
@Renra: Create a solution with two project files and call xbuild?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.