I would like to reference the System.Drawing.dll in a console app I am writing using Visual Studio Code on OSX. i.e. I want to use these using statements
using System.Drawing; using System.Drawing.Imaging;
to avoid this build error
Program.cs(56,20): error CS0246: The type or namespace name `Bitmap' could not be found. Are you missing an assembly reference?
I can't find a tutorial on this, I don't even know if the dll is available in .net core or mono or whatever visual-studio-code uses.
In the Project Designer, click the References tab. Click the Add button to open the Add Reference dialog box. In the Add Reference dialog box, select the tab indicating the type of component you want to reference. Select the components you want to reference, and then click OK.
You can use the Find All References command to find where particular code elements are referenced throughout your codebase. The Find All References command is available on the context (right-click) menu of the element you want to find references to. Or, if you are a keyboard user, press Shift + F12.
Reference assemblies are usually distributed with the Software Development Kit (SDK) of a particular platform or library. Using a reference assembly enables developers to build programs that target a specific library version without having the full implementation assembly for that version.
In your .csproj file, add your dependency as a PackageReference
in an ItemGroup
, then run dotnet restore
or nuget restore
. Example:
<ItemGroup> <Reference Include="System" /> <Reference Include="System.Xml" /> <Reference Include="System.Core" /> <Reference Include="Xamarin.iOS" /> <PackageReference Include="Realm" Version="2.1.0" /> <PackageReference Include="xunit"> <Version>2.3.1</Version> </PackageReference> </ItemGroup>
Take a look at this article for a full explanation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With