Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find System.Windows.Media namespace?

I'm using an object from a 3rd party API that has a property of type System.Windows.Media.ImageSource, yet I can't seem to find the System.Windows.Media namespace anywhere. If I try to add a reference to my project I don't see System.Windows.Media in the list of options. My project is also targeting .Net 3.5.

Is there something else I need to do to be able to access this namespace?

like image 535
Eric Anastas Avatar asked Jun 30 '10 23:06

Eric Anastas


5 Answers

You should add reference to PresentationCore.dll.

like image 73
MegaMilivoje Avatar answered Nov 03 '22 16:11

MegaMilivoje


The System.Windows.Media.Imaging namespace is part of PresentationCore.dll (if you are using Visual Studio 2008 then the WPF application template will automatically add this reference). Note that this namespace is not a direct wrapping of the WIC library, although a large proportion of the more common uses are still available and it is relatively obvious how these map to the WIC versions. For more information on the classes in this namespace check out

http://msdn2.microsoft.com/en-us/library/system.windows.media.imaging.aspx

like image 66
VOX Avatar answered Nov 03 '22 16:11

VOX


Add PresentationCore.dll to your references. This dll url in my pc - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\PresentationCore.dll

like image 38
Mamedov Avatar answered Nov 03 '22 14:11

Mamedov


For Visual Studio 2017

Find "References" in Solution explorer

Right click "References"

Choose "Add Reference..."

Find "Presentation.Core" list and check checkbox

Click OK

like image 18
Mike from PSG Avatar answered Nov 03 '22 14:11

Mike from PSG


You can add PresentationCore.dll more conveniently by editing the project file. Add the following code into your csproj file:

<ItemGroup>
   <FrameworkReference Include="Microsoft.WindowsDesktop.App" />
</ItemGroup>

In your solution explorer, you now should see this framework listed, now. With that, you then can also refer to the classes provided by PresentationCore.dll.

like image 15
Owlbuster Avatar answered Nov 03 '22 15:11

Owlbuster