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!!
The Mono C# compiler is considered feature complete for C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0 and C# 6.0 (ECMA) and it has partial support for C# 7. Historically, various version of same compiler existed.
Visual Studio - Windows only Visual Studio is the compiler and IDE created by Microsoft for Windows computers. Visual Studio has several versions. The professional version can compile C# code, as well as a number of other languages.
First compile ProgramLib to ProgramLib.dll, then reference it:
$ gmcs -t:library ProgramLib.cs
$ gmcs -r:ProgramLib.dll Program.cs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With