Namespace Media does not exist
I am developing in Unity 4.7.1f1 using Visual Studio 2015 C# on Windows 8. I'm trying to do some bitmap processing using the Kinect background removal tool. The class starts with these lines:
using System.Windows.Media;
using System.Windows.Media.Imaging;
This produce the following error:
The type or namespace name 'Media' does not exist in the namespace 'Windows' (are you missing an assembly reference?)
I need this for types PixelFormat
, WritableBitmap
, andInt32Rect
.
My reading, including searches through Unity Answers and Stack Overflow, has indicated the following:
Adding the assembly in Visual Studio will not have it compile properly. Unity needs to have it added in Unity/Mono.
This component of Windows is in PresentationCore.dll which you can copy to the project.
I tried the following solutions:
I copied the PresentationCore.dll file from
Program Files\Reference Assemblies\Microsoft\Framework.NetFramework\v4.0\Profile
to theAssets
folder by dragging it to the 'Project' pane's Assets folder.I copied the PresentationCore.dll file from a subfolder of
\Windows\WinSxS
to theAssets
folder by dragging it to the 'Project' pane's Assets folder.I checked I was building for .NET 2.0 and not a subset.
None of this cleared the error. I would restart Unity and load the files in Visual Studios when making a change. How to I get Mono to use accept reference to it? Am I missing something very simple? Like a step after I copy the DLL to the assets folder?
Your answer
Follow this Question
Related Questions
Namespace inside DLL file 0 Answers
Can't reference other namespaces from within TextMeshPro (TMPro) namespace. 0 Answers
DllNotFoundException, C++ dll used with an assembly, not possible? 0 Answers
How to get started with Azure Blobg Storage? (How to I add the correct namespace?) 1 Answer
Failed to create compiler instance 0 Answers