Home > OS >  Add reference to a single DLL file
Add reference to a single DLL file

Time:07-04

I would like to add a reference to /path/to/lib.dll using the .NET CLI. All the results on google tell me how to add a project reference, but I want to add a single DLL file that is not in a project. I know how to do this in Visual studio, but how do I do it from the command-line?

CodePudding user response:

edit your .csproj and add:

<ItemGroup>
  <Reference Include="MyAssembly">
    <HintPath>path\to\MyAssembly.dll</HintPath>
  </Reference>
</ItemGroup>

and then dotnet restore

Reference: https://medium.com/@tonerdo/referencing-a-net-dll-directly-using-the-net-core-toolchain-16f0af46a4dc

  • Related