Description
openedon Aug 22, 2023
Describe the bug
The behavior of <EmbeddedResource>
will change based on the culture settings of the current environment. By default it attempts to do culture specific resource handling. This is accomplished by taking the last portion of the file name, checking if it's a valid culture, if so then treat it like a culture specific resource. There is no way to override this behavior.
That means though if the final portion of your file name is a culture name on the current environment then it will be treated differently than other resources. Different OS / runtimes can have different cultures which altogether makes for non-deterministic behavior.
To Reproduce
- Create a simple console app
- Create a file called bin\System.Reflection.Metadata.dll.
- Include the following in your build file:
<EmbeddedResource Include="bin\System.Reflection.Metadata.dll">
<LogicalName>net.Metadata</LogicalName>
</EmbeddedResource>
- Build
On Windows using dotnet build
or msbuild
this will produce a binary that has an embedded resource named net.Metadata
. On Linux it will not because "metadata"
is a valid culture name.