diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs
index 01c286a7ec2f4..769050ce46667 100644
--- a/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs
+++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs
@@ -198,7 +198,10 @@ public void BugRegression_60479_WithRazorClassLib()
.ExecuteWithCapturedOutput("new razorclasslib")
.EnsureSuccessful();
- AddItemsPropertiesToProject(wasmProjectFile, extraItems:@"
+ AddItemsPropertiesToProject(wasmProjectFile, extraItems: UseWebcil ? @"
+
+
+ " : @"
");
@@ -223,7 +226,7 @@ public void BugRegression_60479_WithRazorClassLib()
throw new XunitException($"Could not find resources.lazyAssembly object in {bootJson}");
}
- Assert.Contains("RazorClassLibrary.dll", lazyVal.EnumerateObject().Select(jp => jp.Name));
+ Assert.Contains("RazorClassLibrary.webcil", lazyVal.EnumerateObject().Select(jp => jp.Name));
}
[ConditionalTheory(typeof(BuildTestBase), nameof(IsUsingWorkloads))]
diff --git a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs
index 36145f4573d71..0eddaf4d4aed9 100644
--- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs
+++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs
@@ -373,6 +373,9 @@ private List ComputeUpdatedAssemblies(
assetsToUpdate.Add(satelliteAssembly.ItemSpec, satelliteAssembly);
var culture = satelliteAssembly.GetMetadata("AssetTraitValue");
var fileName = Path.GetFileName(satelliteAssembly.GetMetadata("RelativePath"));
+ if (IsWebCilEnabled)
+ fileName = Path.ChangeExtension(fileName, ".dll");
+
if (satelliteAssemblies.TryGetValue((culture, fileName), out var existing))
{
filesToRemove.Add(existing);
diff --git a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ConvertDllsToWebCil.cs b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ConvertDllsToWebCil.cs
index fc8136525bd68..17cc80053284d 100644
--- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ConvertDllsToWebCil.cs
+++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ConvertDllsToWebCil.cs
@@ -62,7 +62,11 @@ public override bool Execute()
var webcilWriter = Microsoft.WebAssembly.Build.Tasks.WebcilConverter.FromPortableExecutable(inputPath: filePath, outputPath: tmpWebcil, logger: Log);
webcilWriter.ConvertToWebcil();
- var finalWebcil = Path.Combine(OutputPath, Path.GetFileNameWithoutExtension(filePath) + ".webcil");
+ string candicatePath = Path.Combine(OutputPath, candidate.GetMetadata("Culture"));
+ if (!Directory.Exists(candicatePath))
+ Directory.CreateDirectory(candicatePath);
+
+ var finalWebcil = Path.Combine(candicatePath, Path.GetFileNameWithoutExtension(filePath) + ".webcil");
if (Utils.CopyIfDifferent(tmpWebcil, finalWebcil, useHash: true))
Log.LogMessage(MessageImportance.Low, $"Generated {finalWebcil} .");
else
@@ -72,10 +76,16 @@ public override bool Execute()
var webcilItem = new TaskItem(finalWebcil, candidate.CloneCustomMetadata());
webcilItem.SetMetadata("RelativePath", Path.ChangeExtension(candidate.GetMetadata("RelativePath"), ".webcil"));
- webcilItem.SetMetadata("AssetTraitName", "WasmResource");
- webcilItem.SetMetadata("AssetTraitValue", "runtime");
webcilItem.SetMetadata("OriginalItemSpec", finalWebcil);
+ if (webcilItem.GetMetadata("AssetTraitName") == "Culture")
+ {
+ string relatedAsset = webcilItem.GetMetadata("RelatedAsset");
+ relatedAsset = Path.ChangeExtension(relatedAsset, ".webcil");
+ webcilItem.SetMetadata("RelatedAsset", relatedAsset);
+ Log.LogMessage(MessageImportance.Low, $"Changing related asset of {webcilItem} to {relatedAsset}.");
+ }
+
webCilCandidates.Add(webcilItem);
}
else
diff --git a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/GenerateWasmBootJson.cs b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/GenerateWasmBootJson.cs
index d8a5a3d2ae9e6..7cb776c236229 100644
--- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/GenerateWasmBootJson.cs
+++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/GenerateWasmBootJson.cs
@@ -174,7 +174,7 @@ public void WriteBootJson(Stream output, string entryAssemblyName)
}
else if (string.Equals("symbol", assetTraitValue, StringComparison.OrdinalIgnoreCase))
{
- if (TryGetLazyLoadedAssembly($"{fileName}.dll", out _))
+ if (TryGetLazyLoadedAssembly($"{fileName}.dll", out _) || TryGetLazyLoadedAssembly($"{fileName}.webcil", out _))
{
Log.LogMessage(MessageImportance.Low, "Candidate '{0}' is defined as a lazy loaded symbols file.", resource.ItemSpec);
resourceData.lazyAssembly ??= new ResourceHashesByNameDictionary();