msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

[Bug]: Satellite assemblies with un-predefined cultures are not copied correctly into depended projects

Open PopSlime opened this issue 1 year ago • 1 comments

Issue Description

Satellite assemblies with un-predefined cultures in a project are not copied correctly into the projects that depends on it.

Steps to Reproduce

Assume that yue is not a predefined language in the system.

  1. Create a project (Project A) with two resources named Test.resx and Test.yue.resx respectively.
  2. Add the following metadata into Project A:
    <PropertyGroup>
    	<RespectAlreadyAssignedItemCulture>True</RespectAlreadyAssignedItemCulture>
    </PropertyGroup>
    <ItemGroup>
    	<EmbeddedResource Update="Test.resx">
    		<Generator>ResXFileCodeGenerator</Generator>
    	</EmbeddedResource>
    	<EmbeddedResource Update="Test.yue.resx">
    		<Culture>yue</Culture>
    		<LogicalName>Test.yue.resources</LogicalName>
    	</EmbeddedResource>
    </ItemGroup>
    
  3. Create another project (Project B) that has a project reference to Project A.
  4. Create another project (Project C) that has a project reference to Project B.
  5. Build the projects.

Expected Behavior

The satellite assembly for the culture yue is correctly copied into Project B and Project C, and also written into their .deps.json.

Actual Behavior

  • The satellite assembly for the culture yue is not copied into Project C at all.
  • The .deps.json in both Project B and Project C do not include the satellite assembly for the culture yue.

Analysis

Suspicious related method: ReferenceTable.FindSatellites()

https://github.com/dotnet/msbuild/blob/4bb8d030c8bb0ffd673c031947251155ecaac390/src/Tasks/AssemblyDependency/ReferenceTable.cs#L974

This method cannot find satellite assemblies with unusual cultures because it is still checking the satellite directory name against CultureInfoCache only.

Related issues and PRs:

  • #9954 (Fixed by #10026)

Versions & Configurations

MSBuild version: 17.11.2.32701

PopSlime avatar Aug 20 '24 11:08 PopSlime

Switching to another resource workflow as this issue seems to be put aside for now

PopSlime avatar Oct 18 '24 13:10 PopSlime

FYI: https://github.com/dotnet/msbuild/pull/11607

YuliiaKovalova avatar Apr 02 '25 16:04 YuliiaKovalova