including resource files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

vb2005
i have a resource file (MyFile.resources) created using resgen.
how do i inculde it within my assembly? i have tried adding it to my project
but it does not get built into the exe, so i get a
MissingManifestResourceException when trying to use resources within it.

any ideas?
 
guy said:
vb2005
i have a resource file (MyFile.resources) created using resgen.
how do i inculde it within my assembly? i have tried adding it to my
project but it does not get built into the exe, so i get a
MissingManifestResourceException when trying to use resources within
it.

any ideas?


Select the file in the solution explorer. In the property window, did you
set the "build action" to embedded resource?


Or, maybe you misspelled the resource name. Try this at application startup
to see the embedded resources:

MsgBox(String.Join(vbCrLf, _
System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceNames _
))



Armin
 
thanks Armin,
yes it has Build Action set to Embedded Resource.
looking at it witl ILDasm does not show the resource, nor does
GetMainfestResourceNames in your example - i must be doing something else
wrong!
 
guy said:
thanks Armin,
yes it has Build Action set to Embedded Resource.
looking at it witl ILDasm does not show the resource, nor does
GetMainfestResourceNames in your example - i must be doing something
else wrong!


Hmm.. strange. I tried the same now: I used "reseditor.exe" (from the
samples), added one bitmap, saved as "test.resources", added the file to the
project ("embedded resource" is set by default) and built the exe.
GetManifestResourceNames returns


WindowsApplication1.Form1.resources
WindowsApplication1.test.resources
WindowsApplication1.Resources.resources

where "test.resources" is the embedded file.

I currently have no clue what's going wrong in your project.... I'll let you
know if something comes into my mind.



Armin
 
Back
Top