Help! Still can't get DirectX to work in C#. Any ideas?

Goragoth

Regular
I posted a while back that I couldn't get code using DirectX in VC# because of a missing assembly reference blah blah blah. So I added the reference manually by browsing to the folder that contains the managed DirectX stuff and it now compiles fine. (I had to manually browse to the WINNT/Microsoft.NET/Managed DirectX/... folder for this as the Microsoft.DirectX stuff did not appear in the list that the add reference dialog gives you, which seemed a bit odd to me).

However, it does not run. The program crashes when trying to create the device with the following:

An unhandled exception of type 'Microsoft.DirectX.Direct3D.InvalidCallException' occurred in microsoft.directx.direct3d.dll

As far as I can figure out the problem is that the dlls that I included as the assembly reference thing (v9.02.2904) do not match those that it says it loads and are in the WINNT/assembly/gac/ folder (v1.0.2902.0).

I went ahead and did the obvious thing. First I uninstalled the dx9c sdk summer 2004 update, then the original dx9 sdk. Then I installed the summer update again and then (when it still did not work) I installed just the dx9c runtimes again as I thought that might be the problem.

Funny thing is that the dx9 sample executables for managed dx run fine although I can't even try to compile them since they are VS2003 files and I have VS2002. So whatever runtimes the C# DirectX9 stuff needs they seem to be there at least.

That was a rather lengthy explanation but I wanted to make sure that I didn't just get a bunch of posts saying "reinstall the SDK" as I have tried that. So, anybody have a clue wtf I might be doing wrong? :(
 
Goragoth said:
I posted a while back that I couldn't get code using DirectX in VC# because of a missing assembly reference blah blah blah. So I added the reference manually by browsing to the folder that contains the managed DirectX stuff and it now compiles fine. (I had to manually browse to the WINNT/Microsoft.NET/Managed DirectX/... folder for this as the Microsoft.DirectX stuff did not appear in the list that the add reference dialog gives you, which seemed a bit odd to me).

However, it does not run. The program crashes when trying to create the device with the following:

An unhandled exception of type 'Microsoft.DirectX.Direct3D.InvalidCallException' occurred in microsoft.directx.direct3d.dll

As far as I can figure out the problem is that the dlls that I included as the assembly reference thing (v9.02.2904) do not match those that it says it loads and are in the WINNT/assembly/gac/ folder (v1.0.2902.0).

I went ahead and did the obvious thing. First I uninstalled the dx9c sdk summer 2004 update, then the original dx9 sdk. Then I installed the summer update again and then (when it still did not work) I installed just the dx9c runtimes again as I thought that might be the problem.

Funny thing is that the dx9 sample executables for managed dx run fine although I can't even try to compile them since they are VS2003 files and I have VS2002. So whatever runtimes the C# DirectX9 stuff needs they seem to be there at least.

That was a rather lengthy explanation but I wanted to make sure that I didn't just get a bunch of posts saying "reinstall the SDK" as I have tried that. So, anybody have a clue wtf I might be doing wrong? :(


the dlls your looking for should be located here

C:\WINDOWS\Microsoft.NET\Managed DirectX\v9.02.2904\Microsoft.DirectX.Direct3D.dll

also to use some of the debugers included these dlls should be moved into the same directory as your program.

If you want to compile the samples or copy some of the code out of them they depend on the "common" folder being 1 or 2 directorties(can't remember) above the program root. Of course you can just change the refrences but these are some of things I have run into so far.

Also if your interested I can get you the link but visual studio dotnet 2004 is free right know as beta, It's stable and should work with this but I still use 03, because 04 is avaliable in seperate languages like vs2004 c# and vs2004 vb.net, I like to be able to switch languages withen the same program,even though I only use c#. :)
 
I switched from vs2002 to vs2003 and it all works fine now and all the references are there etc...
This is really weird because my friend had DirectX working fine in vs2002. Oh well, at least it works now :)
 
Back
Top