By default when you add an image (icon, bitmap, etc.) as a resource to your project, the image's Build Action is set to None. This is done because the image is magically stored inside a .resources file.
I want the resource to be stored as an embedded resource (my reasons are irrelevant, but let's just pretend it's so that I can see them inside RedGate's Reflector).
So I changed each image's Build Action to Embedded Resource, and the resource then appears inside Lutz's Reflector - exactly as I want.
Unfortunately, Microsoft says specifically not to do this:
Note that when the resource editor
adds an image, it sets Build Action to
None, because the .resx file
references the image file. At build
time, the image is pulled into the
.resources file created out of the
.resx file. The image can then easily
be accessed via the strongly-typed
class auto-generated for the .resx
file.
Therefore, you should not change
this setting to Embedded Resource,
because doing so would include the
image twice in the assembly.
So what is the proper way to include an image as an embedded resource?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…