xaberue
xaberue

Reputation: 316

DependentUpon not working for RESX files on .NET Core

I am facing a small problem, I am trying to collapse inside Solution Explorer all localizable RESX files insde it own main RESX file, I have tried different approaches but no one seems to work, the code I have right now inside CSPROJ is the follwing:

<ItemGroup>
<Compile Update="Resources\ExceptionResources.Designer.cs">
  <DesignTime>True</DesignTime>
  <AutoGen>True</AutoGen>
  <DependentUpon>ExceptionResources.resx</DependentUpon>
</Compile>
<Compile Update="Resources\ExceptionResources.es-ES.resx">
  <DependentUpon>ExceptionResources.resx</DependentUpon>
</Compile>
<EmbeddedResource Update="Resources\ExceptionResources.resx">
  <Generator>ResXFileCodeGenerator</Generator>
  <LastGenOutput>ExceptionResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\ExceptionResources.es-ES.resx">
  <Generator>ResXFileCodeGenerator</Generator>
  <LastGenOutput>ExceptionResources.Designer.cs</LastGenOutput>
</EmbeddedResource>

However inside Solution Explorer I can see the following:

enter image description here

Of course it is not a big problem for the project, but I wanted to know how can I collapse by using DependentUpon as how I used to do.

Thank you in advance for your time, help and collaboration :)

Upvotes: 1

Views: 1143

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100581

The ExceptionResources.es-ES.resx is likely already an EmbeddedResource item so a <Compile Update=… on it will have no effect.

Instead, extend your <EmbeddedResource Update=…:

<EmbeddedResource Update="Resources\ExceptionResources.es-ES.resx">
  <DependentUpon>ExceptionResources.resx</DependentUpon>
  <Generator>ResXFileCodeGenerator</Generator>
  <LastGenOutput>ExceptionResources.Designer.cs</LastGenOutput>
</EmbeddedResource>

Upvotes: 3

Related Questions