Here's what I've done:
I created a resource.resx
file using my IDE (SharpDevelop) and added an logo.ico
to it. The resource.resx file looks something like this:
<data name="logo" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAA... (etc etc)
Then I used ResGen.exe
to compile this resource.resx
into a valid resource.resources
file.
resgen.exe resource.resx resource.resources
Using the command line JScript.NET compiler I compiled everything and included my resource.resources
which has my logo file.
jsc /res:resource.resources /out:app.exe /reference:UI.dll,Remote.dll app.cs
Now I want to access this logo file from withing my code, so I've got this:
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.Drawing.Icon icon = new System.Drawing.Icon(assembly.GetManifestResourceStream("resource.resources.logo"));
However I get a runtime Exception for GetManifestResourceStream
which is null.
I suppose this is a namespace issue so I tried accessing the resource file only with GetManifestResourceStream("resource.resources")
but I get this other Exception:
Argument 'picture' must be a picture that can be used as a Icon.
Any ideas would be greatly appreciated, thanks!