I am getting the following compile-time error:
The type or namespace name 'Bitmap' could not be found (are you missing a using directive or an assembly reference?)
Here is my code:
BitmapImage img = new BitmapImage();
You have to add System.Drawing
to your references so in solution
Explorer rightclick on References and click on Add References and in
assemblies find System.Drawing
and click OK
Today (2020 year) it's nuGet package System.Drawing.Common.dll
.
To add it: right click on project name (at solution explorer) --> "Manage NuGet packages" --> choose "Browse" label at the top --> search for "System.Drawing.Common" --> install it.
Add PresentationCore as a reference.
The PresentationCore assembly appears in the References list for your project.
Add a using directive for the System.Windows.Media.Imaging namespace at the top of the file, which is where BitmapImage
lives.
using System;
using System.Windows.Media.Imaging;
Perhaps you need to add:
using System.Windows.Media.Imaging;
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