0

Not at all like this thread How do I add assembly references in Visual Studio Code? Someone has given me 2 dlls, I need to add(reference ) them in my project, I am writing a plugin of sorts. It's my first C# project since I stopped programming about 4 years ago.

dotnet add reference {path to my first dll}

Just produces a message that tells me I am on the wrong track completely. I have the using statements, which require the 2 assemblies, but Visual studio code commands are a little opaque to me still.

2 Answers2

2

You can add a reference to a dll by directly editing the csproj file. Within an ItemGroup (preferably the ItemGroup containing your other references) you can add a Reference property. It should look like the following:

<ItemGroup>
   ...
   <Reference Include="<dll name>">
      <HintPath></HintPath> //Relative Path to dll from csproj directory
   </Reference>
   ...
</ItemGroup>
  • 1
    So the VSCode console commands was the wrong track, and I just needed pointers on how to edit the project manually , thanks Gustavo. –  Jul 10 '20 at 12:20
1

1) For an easy and fast way to add DLL's you can drag and drop them into your solution Reference folder then rebuild your project.

2) The second way, you can right-click on the Reference folder in your VS solution and (add reference) then rebuild your project.

smie
  • 11
  • 2