Skip to content

Commit

Permalink
[release/8.0] [browser] Fix processing of satellite assemblies from r…
Browse files Browse the repository at this point in the history
…eferenced assembly during publish (#109920)

* Enable satellite discovery in nested build and include them in WasmAssembliesFinal

* Fix RawFileName for satellites from References
  • Loading branch information
maraf authored Dec 2, 2024
1 parent 2eb7dd0 commit 85de952
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/mono/wasm/build/WasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
<!-- Use a unique property, so the already run wasm targets can also run -->
<MSBuild Projects="$(MSBuildProjectFile)"
Targets="WasmNestedPublishApp"
Properties="_WasmInNestedPublish_UniqueProperty_XYZ=true;;WasmBuildingForNestedPublish=true;DeployOnBuild=;_IsPublishing=;_WasmIsPublishing=$(_IsPublishing)">
Properties="_WasmInNestedPublish_UniqueProperty_XYZ=true;;WasmBuildingForNestedPublish=true;DeployOnBuild=;_IsPublishing=;_WasmIsPublishing=$(_IsPublishing);ResolveAssemblyReferencesFindRelatedSatellites=true">
<Output TaskParameter="TargetOutputs" ItemName="WasmNestedPublishAppResultItems" />
</MSBuild>

Expand Down Expand Up @@ -503,6 +503,7 @@
<Target Name="_AfterWasmBuildApp">
<ItemGroup>
<WasmAssembliesFinal Include="@(_WasmAssembliesInternal)" LlvmBitCodeFile="" />
<WasmAssembliesFinal Include="@(_WasmSatelliteAssemblies)" />
</ItemGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ public override bool Execute()
assetCandidate.SetMetadata("AssetTraitName", "Culture");
assetCandidate.SetMetadata("AssetTraitValue", inferredCulture);
assetCandidate.SetMetadata("RelativePath", $"_framework/{inferredCulture}/{satelliteAssembly.GetMetadata("FileName")}{satelliteAssembly.GetMetadata("Extension")}");
assetCandidate.SetMetadata("RelatedAsset", Path.GetFullPath(Path.Combine(OutputPath, "wwwroot", "_framework", Path.GetFileName(assetCandidate.GetMetadata("ResolvedFrom")))));

var resolvedFrom = assetCandidate.GetMetadata("ResolvedFrom");
if (resolvedFrom == "{RawFileName}") // Satellite assembly found from `<Reference />` element
resolvedFrom = candidate.GetMetadata("OriginalItemSpec");

assetCandidate.SetMetadata("RelatedAsset", Path.GetFullPath(Path.Combine(OutputPath, "wwwroot", "_framework", Path.GetFileName(resolvedFrom))));

assetCandidates.Add(assetCandidate);
continue;
Expand Down

0 comments on commit 85de952

Please sign in to comment.