Search code examples
c#.net-coredotnet-cli

How to add .dll file in CLI project without visual studio?


I deleted Visual Studio, but i love c#. I download dotnet from dotnet official site and installed it. Then i writen in command line dotnet new console and all work, dotnet run work. Then i make other folder and there writen dotnet new classlib (is .dll) and it work. But i don't know how to add my .dll file into my project. How to do it?


Solution

  • You either edit the XML of the .csproj file manually, or do it on the command line:

    dotnet add app/app.csproj reference lib/lib.csproj
    

    This adds the XML for you:

    <ItemGroup>
      <ProjectReference Include="..\lib\lib.csproj" />
    </ItemGroup>