Archived

This topic is now archived and is closed to further replies.

Problem building managed DirectX samples with command line tools

This topic is 5151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am having a problem using the command line tools when building some of the managed Direct3D 9.01 samples. Take for example the C# Direct3D Tutorial1, CreateDevice.cs sample. The first thing I do is create a .resx file that contains the directx.ico file since CreateDevice.cs references "directx.ico" as a resource. I make the resource via the following small piece of code:
// MakeResx.cs


using System;
using System.Drawing;
using System.Resources;
 
public class MainApp 
{
   public static void Main() 
   {
      Icon img = new Icon("directx.ico");
      ResXResourceWriter rsxw = new ResXResourceWriter("CreateDevice.resx"); 
      rsxw.AddResource("directx.ico",img);
      rsxw.Close();
   }
}
I build that and run it with no problem. A visual examination of CreateDevice.resx shows the data item named directx.ico as expected:
<data name="directx.ico" type="System.Drawing.Icon, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
mimetype="application/x-microsoft.net.object.bytearray.base64">
    <value>
	AAABAAkAMDAQAAAAAABoBgAAlgAAACAgEAAAAAAA6AIAAP4
	....
    
I then use ResGen to create CreateDevice.resources from CreateDevice.resx. Again, no problem. Then I build CreateDevice.cs via the following command line:
csc /r:%mdx%.dll /r:%mdx%.direct3d.dll /res:CreateDevice.resources CreateDevice.cs
    
The environment variable mdx is just something I made to make the path to the various managed directx assemblies easier to write. It compiles fine with no problem. When I run it, I get the following error:
Unhandled Exception: System.ArgumentException: Resource 'directx.ico' could not be found in class 

'DeviceTutorial.CreateDevice'.
   at System.Drawing.Icon..ctor(Type type, String resource)
   at DeviceTutorial.CreateDevice..ctor()
   at DeviceTutorial.CreateDevice.Main()
    
I can't for the life of me figure out why it is not seeing the directx.ico resource. Any ideas? [edited by - Mastaba on November 8, 2003 5:38:18 PM]

Share this post


Link to post
Share on other sites
It appears to be correctly embedded in the assembly as DeviceTutorial.CreateDevice.resources according to ildasm. If I modify the tutorial so that it uses a ResourceManager object, I have no problem getting the icon with that object. But nothing I''ve tried so far will allow the tutorial sample to work unmodified.

So, at this point I''m desperate. Can anybody with VS.Net and the DX Summer 2003 SDK build the DX90SDK\Samples\C#\Direct3D\Tutorials\Tutorial1 sample project. I''d like to get any resx files and the debug executable the project creates emailed to me, so I could do a file comparison to see just what exactly is different between my hand-made files and those produced via VS.Net.

Share this post


Link to post
Share on other sites
Never mind, I figured out the error in the command line after examining the csproj file. I never thought to look in that file since I figured it was a VS.Net proprietary file (and I don''t own VS.Net). Though once I did, I saw that the icon was to be embedded directly into the assembly and not embedded as an element of a .resources file.

Share this post


Link to post
Share on other sites