Compdigitec Labs

« | Home | »

Linking a shared assembly in the Mono C# compiler

By admin | December 23, 2008

If you wrote a class in C++ and wanted to use it in many applications, you could simple #include it in each application you wanted to use it in. But if you wrote a class in C# and wanted to use it in many applications, you cannot just #include it, because there is no #include in the C# language! The solution to this is to reference the library. This article will show you in easy steps:

  1. After you have written the class, compile it into a library with “gmcs ClassXyz.cs -target:library” (replace ClassXyz.cs with your class’s filename)
  2. The command above should generate a shared library/assembly called ClassXyz.dll.
  3. Now you can compile the application with “gmcs ProgramXyz.cs -reference:ClassXyz.dll”.

If you found this article useful or helpful, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Linux | 8 Comments »

8 Responses to “Linking a shared assembly in the Mono C# compiler”

  1. โซฟา Says:
    July 7th, 2026 at 02:58

    … [Trackback]

    […] Read More Information here on that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  2. จดทะเบียนบริษัท Says:
    July 18th, 2026 at 01:12

    … [Trackback]

    […] Read More Info here on that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  3. king99 Says:
    July 24th, 2026 at 20:24

    … [Trackback]

    […] Find More on that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  4. ปากกาลดน้ำหนัก Ozempic Says:
    July 25th, 2026 at 13:16

    … [Trackback]

    […] Here you can find 51208 more Information to that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  5. ไซด์ไลน์ Says:
    August 3rd, 2026 at 04:17

    … [Trackback]

    […] Info to that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  6. KHAB555 ศูนย์รวมสล็อตกว่า 3,000 เกม Says:
    August 6th, 2026 at 23:16

    … [Trackback]

    […] Find More here on that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  7. ปั้มคนดูไลฟ์ Says:
    August 16th, 2026 at 07:34

    … [Trackback]

    […] Information on that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

  8. visit this website Says:
    August 25th, 2026 at 17:32

    … [Trackback]

    […] Read More Information here on that Topic: compdigitec.com/labs/2008/12/23/linking-a-shared-assembly-in-the-mono-c-compiler/ […]

Comments