N
N
NkDev2020-01-16 15:38:20
C++ / C#
NkDev, 2020-01-16 15:38:20

How to connect your dll library in C# when working from the console?

C#. I work through the console (compilation). Visual Studio is not installed.
I compiled my class library into a dll file.
Then I created a main program file with a Main method. Dll file and program file are in the same folder. I wrote "using MyDll" in the main program. However, the program does not see my library.
Tell me, with what command in the console can I connect the dll file to my project?
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
none7, 2020-01-16
@NkDev

shared1.cs

public class MyShared {
    public static string getHello() => "Hello, World";
}
prog.cs
class MyProgram {
  static void Main(string[] args) => System.Console.WriteLine(MyShared.getHello());
}

csc /t:library shared1.cs
csc /t:exe /r:shared1.dll prog.cs

V
Vladimir Korotenko, 2020-01-16
@firedragon

Install studio or teach https://metanit.com/sharp/tutorial/1.3.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question