Invalid names for embedded resources in .NET assembly

Roberto 41 Reputation points
2021-12-30T08:43:02.237+00:00

Trying to include in a project somes .json files as embedded resources I found that some names are not managed by .NET runtime.
It seems that names that ends with a language acroym and an extension are not compiled as embedded resources.

e.g in a project with following embedded files:

<ItemGroup>
<None Include="App.config" />
<EmbeddedResource Include="CustomizableResources.RU_.json" />
<EmbeddedResource Include="CustomizableResources.other.json" />
<EmbeddedResource Include="Anything.RU.json" />
<EmbeddedResource Include="other.RU.mp3" />
<EmbeddedResource Include="other_RU.json" />
<EmbeddedResource Include="other.RU.json" />
<EmbeddedResource Include="CustomizableResources.RU.json" />
<EmbeddedResource Include="CustomizableResources.IT.json" />
</ItemGroup>

If I recall

var assembly = typeof(Program).Assembly;
var resourNames = assembly.GetManifestResourceNames();

I get only this resources:

  • TestGetManifestResourceNames.CustomizableResources.RU_.json
  • TestGetManifestResourceNames.CustomizableResources.other.json
  • TestGetManifestResourceNames.other_RU.json
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,279 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,125 questions
{count} votes

0 additional answers

Sort by: Most helpful