Search code examples
visual-studioresxsolution-explorer

Localized resx files as sub items in solution explorer


We have a large number of C# projects in a visual studio solution. For a lot of these we have a resource file called 'TextResources.resx'. These have been translated in the past creating several related resx files for example 'TextResources.fr.resx'. For these older projects these translated resx files are showing as sub items of the default english TextResources.resx however for several new projects the translated items are appearing as separate (same tree level) items.

Hopefully this diagram will explain:

Old Projects:

- TextResources.resx
     - TextResources.fr.resx 
     - TextResources.de.resx

New Projects:

- TextResources.fr.resx 
- TextResources.de.resx 
- TextResources.resx 

This not only looks odd but is a little confusing with so many projects. Anyone know why its grouping some translated resx files but not others?


Solution

  • I had the same problem and found no answer either.

    I ended up editing the project (.csproj) file by hand.

    <EmbeddedResource Include="Folder\TextResources.de.resx">
      <DependentUpon>TextResources.resx</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    

    Add the

    <DependentUpon></DependentUpon> 
    

    tag and type out the name of the "parent" resource file without leading folders.