Home All Groups Group Topic Archive Search About

including resource files

Author
14 Mar 2006 1:54 PM
guy
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?

Author
14 Mar 2006 2:12 PM
Armin Zingler
"guy" <g**@discussions.microsoft.com> schrieb
> 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
Author
14 Mar 2006 2:50 PM
guy
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!




Show quoteHide quote
"Armin Zingler" wrote:

> "guy" <g**@discussions.microsoft.com> schrieb
> > 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
>
>
Author
14 Mar 2006 3:26 PM
Armin Zingler
"guy" <g**@discussions.microsoft.com> schrieb
> 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
Author
15 Mar 2006 9:06 AM
guy
Armin, a power off/on fixed this (it makes you wonder...)

thanks

guy

Show quoteHide quote
"Armin Zingler" wrote:

> "guy" <g**@discussions.microsoft.com> schrieb
> > 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
>
>
Author
15 Mar 2006 11:06 AM
Armin Zingler
"guy" <g**@discussions.microsoft.com> schrieb
> Armin, a power off/on fixed this (it makes you wonder...)
>
> thanks
>
> guy

Never wonder. :)


Armin