Converting to .NET 2.0 - Device exists in 2 places

I have a app I wrote in .NET 1.1 and it breaks when running on .NET 2.0.  I figure that I could just rebuild it in VS 2005 with .NET 2.0 and then debug it to find where it breaks.  Unfortunately,  I can't get it to compile at all in VS 2005.  I get the following error.

Error    2    The type 'Microsoft.DirectX.Direct3D.Device' exists in both 'c:\WINDOWS\Microsoft.NET\Managed DirectX\v9.03.91\Microsoft.DirectX.Direct3D.dll' and 'c:\WINDOWS\assembly\GAC_32\Microsoft.DirectX\2.0.0.0__31bf3856ad364e35\Microsoft.DirectX.dll' 
A previous thread suggested using extern aliasing.  Is that the best solution   If so, how do I do that.  Please elaborate.

Thanks!




Answer this question

Converting to .NET 2.0 - Device exists in 2 places

  • NealRM

    You have referenced multiple assemblies - check the references and choose one.

    Exteran aliasing won't help you here.

     



  • mobiledev1

    Thank you for the reply, picking one is not that easy though.  The problem is because the reference Microsoft.DirectX has a namespace in it called Direct3D.  This Direct3D namespace has some things such as the Device object.  The other reference I need, Microsoft.DirectX.Direct3D, also has a Device object.

    So the problem is that 2 seperate assemblies declare a few overlapping objects in the same namespace: Microsoft.DirectX.Direct3D.

    Any help is appreciated.  Also, removing the Microsoft.DirectX.Direct3D reference is not an option.  I need to access objects such as CustomVertex and ColorValue that are only found in it.

  • Robert Kitson

    They are not designed to be used at the same time, the objects in them overlap as you found and they are not compatible with each other and there is not, nor will there be a workaround.

    Remember the 2.0 assemblies are in beta and there are still some thing missing (though other things have been replaced with new things). If you must have them then you have got to go back to the 290x versions which are for .Net 1.1 (though they will run in .Net 2.0 no problem other than the LoaderLock issue).



  • JT_AnnArbor

    Look at the "Empty Project" in the DirectX Sample Browser and compare that to the assemblies referenced in one of the Managed DirectX 2.0 samples (also in the sample browser).  That will help you understand which assemblies you should be referencing.

  • Converting to .NET 2.0 - Device exists in 2 places