locked
Namespaces Microsoft.DirectX not found

    Question

  • I've installed the DirectX 9.0 SDK and the runtime and can run the sample executables, but when I try to run the code in the edit or debug mode (using vb.net ver.2003) it can't find Microsoft.DirectX and Microsoft.DirectX.DirectInput namespaces.  I verified it as having 9.0c using dxdiags.exe.

    It does find DirectX 7 & 8 type libraries in the COM references section...

    I expect to find the missing namespaces in the .NET reference sections.

    Help please.

    Saturday, October 15, 2005 12:52 PM

Answers

  • Hi K,

    What you need to do is add the correct DLLs as references to your project. Since they are not in the list, you'll have to add them manually. I am assuming you are using the October SDK?

    What you'll need to do is:

    1. Right-click on References folder, and select "Add Reference..."
    2. On the .NET tab, select the "Browse" button.
    3. Navigate to where you installed the SDK. (On my machine it is C:\Program Files\Microsoft DirectX 9.0 SDK)
    4. The files you are looking for should be in ".\Developer Runtime\x86\DirectX for Managed Code"
    5. Select the DLLs that you want (in this case Microsoft.DirectX.dll, Microsoft.DirectX.DirectInput.dll)

    Also, to make coding easier, don't forget to add this to the top (General scope, not within a Form or class) of your code:

    Imports Microsoft.DirectX
    Imports Microsoft.DirectX.DirectInput

    Otherwise you'll have to fully reference everything.
    Monday, October 17, 2005 5:34 PM

All replies

  • Hi K,

    What you need to do is add the correct DLLs as references to your project. Since they are not in the list, you'll have to add them manually. I am assuming you are using the October SDK?

    What you'll need to do is:

    1. Right-click on References folder, and select "Add Reference..."
    2. On the .NET tab, select the "Browse" button.
    3. Navigate to where you installed the SDK. (On my machine it is C:\Program Files\Microsoft DirectX 9.0 SDK)
    4. The files you are looking for should be in ".\Developer Runtime\x86\DirectX for Managed Code"
    5. Select the DLLs that you want (in this case Microsoft.DirectX.dll, Microsoft.DirectX.DirectInput.dll)

    Also, to make coding easier, don't forget to add this to the top (General scope, not within a Form or class) of your code:

    Imports Microsoft.DirectX
    Imports Microsoft.DirectX.DirectInput

    Otherwise you'll have to fully reference everything.
    Monday, October 17, 2005 5:34 PM
  • if the dlls don't appear when you browse to
    where you installed them, you can try

    (1) opening command prompt
    (2) go to 'assembly\gac\' folder of your
         current windows installation 
         in my case it is 
         'c:\winnt\assembly\gac'
    (3) copy all the dll from all the microsoft.dir*
         to your public assemblies folder
         in my case 
          'c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\PublicAssemblies'

    next time you open the add reference dialog,
    they should be there.

    Tuesday, October 18, 2005 2:46 AM
  • Thanks again to dmcrews and thank you onishin.

    It turns out that I had to open the cab files which were named appropriately.  I figured that the autoinstall would have taken care of this.

    K
    Friday, October 21, 2005 12:40 AM
  • what did you have to do with the cabs I still have this problem
    Sunday, October 30, 2005 6:22 PM
  • I'm having issues myself.  The first suggestion doesn't work as I do not have those folders, the second suggestion doesn't work because it won't allow me to copy the files.  I have DX 9.0c.
    Tuesday, November 01, 2005 7:18 PM
  • herriojr: Do you have .Net 1.1 installed? If .Net 1.1 is not installed the directX installer will not install the managed libraries. It will not work with .Net 1.0
    Wednesday, November 02, 2005 5:36 PM
  • I might not have installed them in the proper order.  I think I had the SDK before I had the 1.1 .NET framework.  I've just deleted the DirectX 9.0 SDK first, installed the October Update, and then I realized that DirectX 9.0 SDK needed to be installed. 

    The libraries are now recognized, but now I'm having issues with TextureState and some other namespaces not being recognized.  I'm actually trying to just run the Billboard demo to verify that things are working correctly before I start anything else.  The libraries that it is pulling from are:

    C:\WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\Microsoft.DirectX.dll
    C:\WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\Microsoft.DirectX.Direct3D.dll
    C:\WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2908.0\Microsoft.DirectX.Direct3DX.dll

    I am running Visual Studio .NET 2003 with the install order of:
    .NET 1.1
    DirectX 9.0 October Update
    DirectX SDK

    The errors I am getting are these:

    c:\dxsdk\samples\c#\common\d3dfont.cs(40,13): error CS0246: The type or namespace name 'TextureState' could not be found (are you missing a using directive or an assembly reference?)

    c:\dxsdk\samples\c#\common\d3dfont.cs(41,13): error CS0246: The type or namespace name 'TextureState' could not be found (are you missing a using directive or an assembly reference?)

    c:\dxsdk\samples\c#\common\d3dfont.cs(42,13): error CS0246: The type or namespace name 'Sampler' could not be found (are you missing a using directive or an assembly reference?)

    c:\dxsdk\samples\c#\common\d3dapp.cs(219,15): error CS0246: The type or namespace name 'SamplerStates' could not be found (are you missing a using directive or an assembly reference?)

    c:\dxsdk\samples\c#\common\d3dapp.cs(220,15): error CS0246: The type or namespace name 'TextureStates' could not be found (are you missing a using directive or an assembly reference?)

    I hope that's in depth enough for someone to know what's going on.

    Wednesday, November 02, 2005 6:40 PM
  • Sorry about the weird text background color.  It set it to that by default for some reason

    Wednesday, November 02, 2005 6:47 PM
  • Bizzarre - there is no billboard sample any more. I think they removed it in the summer 2004 SDK. If you are running sample code from the previous (summer 2003) sdk then it won't work against the latest MDX DLLs becuase there have been breaking changes.

    Try running the samples that came with the october SDK from the sample browser
    Wednesday, November 02, 2005 8:52 PM
  • The only issue with that is that there are no C# examples with the October Update that I can seem to find.  The reason this is important is because I'm doing an Independant Study on 3D Graphics Programming, and my professor wants me to do it in C# because he plans on using what I teach him to teach future classes who are going to be learning C# as the initial programming language in the future.  Otherwise, I would just go with C++ because I can get that to work and have previously.

    The issue is the whole naming convention.  Because it is called the October Update, is there any other version of the SDK that needs to be installed beforehand?  If not, then the place I screwed up on is the fact that I installed the Directx 9.0 SDK, which probably came in 2003 because I thought the October version was only an update to certain mechanisms.
    Thursday, November 03, 2005 2:50 PM
  • Thats odd the OCtober SDK comes with plenty of c# samples. Run the 'Microsoft DirectX SDK (October)/Sample Browser' from the start menu or run to C:\Program Files\Microsoft DirectX 9.0 SDK (October 2005)\Samples\SampleBrowser\SampleBrowser.exe

    Others have noticed that its called an update and got confused. It is an update from the last time, generally minro changes. However they include everything in the SDK so you don't need to install any previous versions - in fact you can safely uninstall any previous versions without issue.

    If you installed the October SDK though the worst tht should happen is you have 2 SDKs on your machine - I have 4 on mine right now. You get a bigger choice of assembly versions when you add references but that it all.

    Don't forge don't use the directX.dll that has a version number starting with 2 - thats the beta of the .Net 2.0 stuff and its pretty broken.
    Thursday, November 03, 2005 8:14 PM
  • Ah, ok.  When I was rummaging around the folders inside the October SDK folder, the first couple managed sample folders I opened were VB, so out of idiocy, I assumed the rest were VB.  After taking so many logic courses, I should have known better.

    It's nice to know about the sample browser :)

    Thanks for clearing up my discrepancy with the naming conventions also.

    Friday, November 04, 2005 4:38 AM