I have a DLL (not a NuGet package) I want to reference in a C# program, in Visual Studio Code (not Visual Studio) V1.52.1. I cannot seem to add the reference.
The DLL is named Plumage.dll. The source code line looks like this:
Plumage.TSDRReq t = new Plumage.TSDRReq();
That generates the error "The type or namespace name 'Plumage' could not be found (are you missing a using directive or an assembly reference?) [testplum]csharp(CS0246)"
Adding
Using Plumage;
does not help and generates the same error message for that line.
I have tried copying the dll to: the same directory as my source; to the subdirectories obj\Debug\net5.0
and obj\Debug\net5.0\ref
; and to the subdirectories bin\Debug\net5.0
and bin\Debug\net5.0\ref
.
I have tried adding different variations of the following to my.csproj file:
<ItemGroup>
<Reference Include="Plumage.dll">
<HintPath>Plumage.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup>
I am running dotnet restore
(and/or dotnet restore force
) after changes. Still no progress.
I've read and tried the approaches here (but that's to add a project, not a dll) and here .
I'm finding a lot of information on how to add a NuGet package (but this is not a NuGet package); and a lot of information adding a reference using Visual Studio (but this is Visual Studio Code ); but I'm still stuck.
The Include
attribute in the Reference
tag isn't supposed to have the .dll
extension. It's not a filename.
You can see examples in this answer: https://stackoverflow.com/a/16580870/103167 and in this question: Which one is correct approach for assembly reference in csproj file?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.