17

I'm trying to run a program that contains the line

using System.Windows.Media.Imaging;

but it give me this error

Error 1 The type or namespace name 'Media' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)

What can I do? Can I download it from somewhere?

David
  • 34,223
  • 3
  • 62
  • 80
emykindman
  • 193
  • 1
  • 3
  • 8

2 Answers2

33

Have you tried adding PresentationCore to your References? Bring up the Solution Explorer (Ctrl + W, S or choose the menu item View | Solution Explorer). Right click on the References node for you project and choose Add References. Look for PresentationCore in the .NET page of the Add References dialog. After you add that to your project, you will be able to add System.Windows.Media to your using statements.

TYeeTY
  • 577
  • 8
  • 16
  • What do you do if there is no PresentationCore in the "Add References" dialog? Mine says "No Framework assemblies were found on the machine." – RhetoricalRuvim Dec 20 '17 at 03:31
  • 1
    Have you checked these folders? C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCore.dll C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCore.dll If dll isn't there, you can always download assemblies and add dll to the reference. Follow this link: https://www.dll-files.com/presentationcore.dll.html – Shehroz Khan Aug 02 '21 at 14:34
5

You probably need to add PresentationCore.dll to your list of referenced assemblies.