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?

4
  • This is library specific, not executable specific. This also includes how to write the source code, not just compiling source code. Commented Feb 6, 2017 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. Commented Feb 6, 2017 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. Commented Feb 6, 2017 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. Commented Feb 6, 2017 at 20:35

1 Answer 1

1

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

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.