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;
ApplyPublishProperties(newDotNetWasm);
nativeStaticWebAssets.Add(newDotNetWasm);
+
if (resolvedNativeAssetToPublish.TryGetValue("dotnet.native.wasm", out var resolved))
{
filesToRemove.Add(resolved);
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");
// 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))
{
}
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
}