diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets index 251119c4af288..4f83cc287a38c 100644 --- a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets +++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets @@ -218,7 +218,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_WasmBuildWebCilPath>$(IntermediateOutputPath)webcil - + @@ -391,7 +391,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_WasmPublishWebCilPath>$(IntermediateOutputPath)webcil\publish - + 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 413fcdff3da76..4bbbf8f62501d 100644 --- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ConvertDllsToWebCil.cs +++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ConvertDllsToWebCil.cs @@ -25,6 +25,9 @@ public class ConvertDllsToWebCil : Task [Required] public string OutputPath { get; set; } + [Required] + public string IntermediateOutputPath { get; set; } + [Required] public bool IsEnabled { get; set; } @@ -36,6 +39,7 @@ public class ConvertDllsToWebCil : Task [Output] public string[]? FileWrites => _fileWrites.ToArray(); + public override bool Execute() { var webCilCandidates = new List(); @@ -52,13 +56,17 @@ public override bool Execute() var extension = candidate.GetMetadata("Extension"); var filePath = candidate.ItemSpec; + var webcilFileName = Path.GetFileNameWithoutExtension(filePath) + Utils.WebcilInWasmExtension; if (!Directory.Exists(OutputPath)) Directory.CreateDirectory(OutputPath); if (extension == ".dll") { - var tmpWebcil = Path.GetTempFileName(); + var tmpDir = IntermediateOutputPath; + if (!Directory.Exists(tmpDir)) + Directory.CreateDirectory(tmpDir); + var tmpWebcil = string.Concat (tmpDir, webcilFileName); var webcilWriter = Microsoft.WebAssembly.Build.Tasks.WebcilConverter.FromPortableExecutable(inputPath: filePath, outputPath: tmpWebcil, logger: Log); webcilWriter.ConvertToWebcil(); @@ -66,7 +74,7 @@ public override bool Execute() if (!Directory.Exists(candicatePath)) Directory.CreateDirectory(candicatePath); - var finalWebcil = Path.Combine(candicatePath, Path.GetFileNameWithoutExtension(filePath) + Utils.WebcilInWasmExtension); + var finalWebcil = Path.Combine(candicatePath, webcilFileName); if (Utils.CopyIfDifferent(tmpWebcil, finalWebcil, useHash: true)) Log.LogMessage(MessageImportance.Low, $"Generated {finalWebcil} ."); else