From 16ca9e77bbb3941d522f42dbf4c244abd83d41ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Thu, 25 Jul 2024 10:01:22 +0200 Subject: [PATCH 1/3] Fix computing destination subPath --- .../AssetsComputingHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/AssetsComputingHelper.cs b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/AssetsComputingHelper.cs index 6885bf62343c7f..24176df2605681 100644 --- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/AssetsComputingHelper.cs +++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/AssetsComputingHelper.cs @@ -107,7 +107,7 @@ public static string GetCandidateRelativePath(ITaskItem candidate, bool fingerpr { fileName = Path.GetFileNameWithoutExtension(destinationSubPath); extension = Path.GetExtension(destinationSubPath); - subPath = destinationSubPath.Substring(fileName.Length + extension.Length); + subPath = destinationSubPath.Substring(0, destinationSubPath.Length - (fileName.Length + extension.Length)); ; } string relativePath; From dc37a2e2bc92b34f5437c3602ea89f5c2a04f560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Thu, 25 Jul 2024 11:43:08 +0200 Subject: [PATCH 2/3] Fix target path for blazor publish extensions --- .../GenerateWasmBootJson.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 748671aeec8984..eaaf55c20ae939 100644 --- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/GenerateWasmBootJson.cs +++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/GenerateWasmBootJson.cs @@ -336,7 +336,7 @@ public void WriteBootJson(Stream output, string entryAssemblyName) resourceList = new(); resourceData.extensions[extensionName] = resourceList; } - var targetPath = resource.GetMetadata("TargetPath"); + var targetPath = endpointByAsset[resource.ItemSpec].ItemSpec; Debug.Assert(!string.IsNullOrEmpty(targetPath), "Target path for '{0}' must exist.", resource.ItemSpec); AddResourceToList(resource, resourceList, targetPath); continue; @@ -431,7 +431,7 @@ void AddResourceToList(ITaskItem resource, ResourceHashesByNameDictionary resour { if (!resourceList.ContainsKey(resourceKey)) { - Log.LogMessage(MessageImportance.Low, "Added resource '{0}' to the manifest.", resource.ItemSpec); + Log.LogMessage(MessageImportance.Low, "Added resource '{0}' with key '{1}' to the manifest.", resource.ItemSpec, resourceKey); resourceList.Add(resourceKey, $"sha256-{resource.GetMetadata("Integrity")}"); } } From 254c0bc4512edfff7a8b86a0658acd43f65fb4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Thu, 25 Jul 2024 12:11:17 +0200 Subject: [PATCH 3/3] Feedback --- .../AssetsComputingHelper.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/AssetsComputingHelper.cs b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/AssetsComputingHelper.cs index 24176df2605681..b7bdbd752edb81 100644 --- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/AssetsComputingHelper.cs +++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/AssetsComputingHelper.cs @@ -107,7 +107,9 @@ public static string GetCandidateRelativePath(ITaskItem candidate, bool fingerpr { fileName = Path.GetFileNameWithoutExtension(destinationSubPath); extension = Path.GetExtension(destinationSubPath); - subPath = destinationSubPath.Substring(0, destinationSubPath.Length - (fileName.Length + extension.Length)); ; + subPath = Path.GetDirectoryName(destinationSubPath); + if (!string.IsNullOrEmpty(subPath)) + subPath += "/"; } string relativePath;