Search code examples
c#.netvisual-studio-2010embedded-resourceresx

How to use resources from "Resources embedded in resx"?


My Visual Studio solution has two sets of resources with different persistence types:

There seems to be a bug in Visual Studio 2010 where i cannot select resources from the embedded in resx set:

enter image description here

How do i convince Visual Studio 2010 to let me use resources in the project?


Of course i could set the images at runtime:

public ImportNSAKnownTerroristsListForm()
{
   InitializeComponent();

   toolStripButton1.Image = Properties.AvatarSharedResources.NewDocument;
}

But i'm not willing to do that.


From MSDN:

Embedded Resources

Embedded resources are the best choice if you have to share application resource (.resx) files between multiple projects. For example, if you have a common resource file that contains your company's logos, trademark information, and such, using embedded resources means you have to copy only the .resx file and not the associated resource data files.


Update: Embedded in .resx resource in different folder (per Hans' musing):

enter image description here


Update: Someone edited my title to

  • How to use resources from "Resources embedded in resx"?

This is incorrect, as that would lead to duplicated titles, rather than the correct:

  • Visual Studio 2010: How to use resources from "Resources embedded in resx"?
  • Visual Studio 2008: How to use resources from "Resources embedded in resx"?
  • Visual Studio 2005: How to use resources from "Resources embedded in resx"?

But i need to not get into a pissing match with a troll.


Solution

  • The answer is that a shared resx file (and designer) must be in the "root" folder.

    Anyplace else and VS will not find it.