未验证 提交 cdff572b 编写于 作者: M Marek Fišera 提交者: GitHub

Fix treating dotnet.wasm or dotnet.native.wasm as native asset (#89079)

上级 87249338
......@@ -3,12 +3,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.NET.Sdk.WebAssembly;
namespace Microsoft.NET.Sdk.WebAssembly;
......@@ -265,6 +263,7 @@ public override bool Execute()
ApplyPublishProperties(newDotNetWasm);
nativeStaticWebAssets.Add(newDotNetWasm);
if (resolvedNativeAssetToPublish.TryGetValue("dotnet.native.wasm", out var resolved))
{
filesToRemove.Add(resolved);
......@@ -592,7 +591,14 @@ private void ApplyPublishProperties(ITaskItem newAsemblyAsset)
continue;
}
var fileName = candidate.GetMetadata("FileName");
var extension = candidate.GetMetadata("Extension");
if (string.Equals(candidate.GetMetadata("AssetType"), "native", StringComparison.Ordinal) && (fileName == "dotnet" || fileName == "dotnet.native") && extension == ".wasm")
{
ResolveAsNativeAsset(Log, resolvedNativeAssetToPublish, candidate, extension);
continue;
}
if (string.Equals(extension, ".dll", StringComparison.Ordinal) || string.Equals(extension, Utils.WebcilInWasmExtension, StringComparison.Ordinal))
{
var culture = candidate.GetMetadata("Culture");
......@@ -643,6 +649,12 @@ private void ApplyPublishProperties(ITaskItem newAsemblyAsset)
// Capture all the native unfiltered assets since we need to process them to determine what static web assets need to get
// upgraded
if (string.Equals(candidate.GetMetadata("AssetType"), "native", StringComparison.Ordinal))
{
ResolveAsNativeAsset(Log, resolvedNativeAssetToPublish, candidate, extension);
continue;
}
static void ResolveAsNativeAsset(TaskLoggingHelper log, Dictionary<string, ITaskItem> resolvedNativeAssetToPublish, ITaskItem candidate, string extension)
{
var candidateName = $"{candidate.GetMetadata("FileName")}{extension}";
if (!resolvedNativeAssetToPublish.ContainsKey(candidateName))
......@@ -651,9 +663,8 @@ private void ApplyPublishProperties(ITaskItem newAsemblyAsset)
}
else
{
Log.LogMessage(MessageImportance.Low, "Duplicate candidate '{0}' found in ResolvedFilesToPublish", candidate.ItemSpec);
log.LogMessage(MessageImportance.Low, "Duplicate candidate '{0}' found in ResolvedFilesToPublish", candidate.ItemSpec);
}
continue;
}
#pragma warning restore CA1864
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册