2

I need to use the BitmapImage class which is part of the System.Windows.Media.Imaging namespace.

From Visual Studio 2012 Express, I started with a WPF desktop application project template, and I can see the relevant dll, PresentationCore.dll is present under the references.

This link on MSDN indicates this reference should be sufficient. This thread indicates the same, and highlights the fact that the necessary dll is referenced by default when using a typical wpf project template in VS2012.

And yet, in my C# code behind, the compiler complains on my using System.Windows.Media.Imaging; statement that Media cannot be found.

This problem seems to not be uncommon, and yet I found no solution to it.

UPDATE: When looking at the properties for the reference to PresentationCore.dll, I see that version is 4.0.0.0 and runtime version is 4.0.30319. I am making a cheap relation to the fact that BitmapImage exists only for .net 4.5 supposedly... Could this be a hint to the problem ?

BuZz
  • 16,318
  • 31
  • 86
  • 141
  • The versions you're seeing are correct. Also, `BitmapImage` exists since .NET 3.0. – Adi Lester Jan 11 '14 at 21:07
  • This question: http://stackoverflow.com/questions/3154198/cant-find-system-windows-media-namepspace has more explicit answers to the above question. – John Sep 04 '14 at 18:37

1 Answers1

4

There are 3 required references need for a WPF project, PresentationCore, PresentationFramework and WindowsBase. See WPF Architecture and WPF Architecture - and overview ... . The second one has a nice description of the contents of the libraries.

Mark Travis
  • 1,049
  • 9
  • 11