-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: dotnet build excludes some embedded files #9287
Comments
I replicated the issue with the example code. When I first built the example project as provided, I noticed that a satellite resource assembly is generated in an I added a <ItemGroup>
<EmbeddedResource Include="Resources\1.X-A.txt" />
<EmbeddedResource Include="1.Y-B.txt" />
<EmbeddedResource Include="Resources\hello.txt" />
</ItemGroup> The
The work-around is to either move As to how and why the behavior is different between |
Neither is necessary--you can instead set the metadata The docs on this could definitely be improved. I'm also surprised msbuild/src/Tasks/CultureInfoCache.cs Line 70 in d074c12
|
I tested the following and it works: <EmbeddedResource Include="Resources\1.X-A.txt" WithCulture="false" />
|
Closing this as a duplicate of #9152. We can't really change this behavior, but we plan on creating MSBuild Analyzers that could detect non-deterministic locale names like this and direct the user to add explicit WithCulture metadata to prevent this kind of foot-gun. |
Issue Description
Some names of embedded files cause them to not be embedded into the built dll when building the project using
dotnet build
. However, when building using Visual Studio ormsbuild
the embedded file is included.A file that will be excluded is one whose name ends in something like 1.X-A.txt
Steps to Reproduce
Showing that it works via msbuild
dotnet restore
msbuild
bin\Debug\net6.0\EmbeddedResourceNotFound.exe
The program prints the contents of the embedded file as expected.
Fails via dotnet build
dotnet clean
dotnet build
bin\Debug\net6.0\EmbeddedResourceNotFound.exe
The program fails with
EmbeddedResourceNotFound.zip
Expected Behavior
dotnet build
should produce a binary that correctly embeds the file regardless of the file name.Actual Behavior
dotnet build
does not include the embedded file into the binary if its name ends in something like 1.X-A.txtAnalysis
No response
Versions & Configurations
No response
The text was updated successfully, but these errors were encountered: