Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the type or namespace name 'directx' does not exist in the namespace 'microsoft'

I have been trying to include DirectX in C sharp project (Visual Studio 2010). I installed DirectX SDK and included the components as:

using Microsoft.DirectX;
using Microsoft.DirextX.Direct3D;

When I try to compile, I get the error: the type or namespace name 'directx' does not exist in the namespace 'microsoft'

Some blogs mentioned that I need to add 'reference' - Microsoft.DirectX under '.NET' tab. But I couldn't find it over there. Neither was any facility to add it to the tab.

Any suggestion will be highly appreciated.

like image 601
Aman Avatar asked Oct 31 '12 11:10

Aman


3 Answers

This was deprecated a long time ago. The last Direct SDK that still has the managed wrappers is February 2010. The download is available here. You'll get to pick the references you are looking for after you install that one.

Better not to use it, no future, look at something like the open source SlimDX or SharpDX projects.

like image 101
Hans Passant Avatar answered Nov 01 '22 13:11

Hans Passant


There are various reasons why a dll would not appear on the .Net tab.There is specific registry configuration that makes certain dlls to appear on the .Net tab.

Alternatively use the browse option to add the dll reference manually to your project.

Project >> Add Reference

enter image description here

like image 41
Prabhu Murthy Avatar answered Nov 01 '22 15:11

Prabhu Murthy


This is the way to add reference for Directx in C# Program :

  • Go to the solution explorer
  • Click references
  • Click add reference
  • Click Browse Go to : "C:\WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\" *usually this is the place of Directx Files located. This can be change with the installation of .net.
  • Select your DirectX package.

example :

(C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\Microsoft.DirectX.dll)
like image 45
Sajith Dinuka Vikasitha Wisump Avatar answered Nov 01 '22 14:11

Sajith Dinuka Vikasitha Wisump