0

I am trying to understand how to create and use a library in C#. In a similar way of understanding it in C using GCC.

I want to only use the command line, and not use Visual Studio IDE.

How can I

  1. Create a library, including

    • Writing the source file, where do I have to use namespace and if yes, do I have to choose the namespace representing the directories where the library file is in?
    • Compiling it into a dll file?
  2. Use the library's dll file in another C# program?

soundslikeodd
  • 1,078
  • 3
  • 19
  • 32
Tim
  • 1
  • 141
  • 372
  • 590
  • This is library specific, not executable specific. This also includes how to write the source code, not just compiling source code. – Tim Feb 06 '17 at 19:39
  • Compiling a DLL is exactly the same as compiling an EXE, with the exception of slightly different choice of command line switches. Writing the source code is exactly like using the IDE, except you use whatever editor you want. If the marked duplicate does not address your question, you need to be more specific, explain what you've tried, and what _exactly_ you are having trouble figuring out. Your question as stated can easily be answered simply by consulting the documentation, if not the marked duplicate. – Peter Duniho Feb 06 '17 at 19:46
  • 1
    I know you said you didn't want to use VS IDE, but if you go into `Tools` > `Options` > `Projects and Solutions` > `Build and Run`, there is an option called `MSBuild project build output verbosity`. If you set this to 'Detailed', you can then see the exact command line passed to `csc.exe` in the output window. That should help you in figuring out how to compile manually from the command line. – Chris Dunaway Feb 06 '17 at 19:59
  • You can even write source code in vim and compile with mono or .net core if you want so, so only using command line. Why would you want to do it is another story. – Evk Feb 06 '17 at 20:35

1 Answers1

1

You need to use command line compiller csc.exe for this.

https://msdn.microsoft.com/en-us/library/78f4aasd.aspx

Uladzimir Palekh
  • 1,846
  • 13
  • 16