diff --git a/NuGet.config b/NuGet.config
index 82b1ce9063aa65..1eaea524958636 100644
--- a/NuGet.config
+++ b/NuGet.config
@@ -9,7 +9,7 @@
-
+
diff --git a/src/tasks/Common/Utils.cs b/src/tasks/Common/Utils.cs
index 8ed6c2c13711e8..4833b4cd19b0cd 100644
--- a/src/tasks/Common/Utils.cs
+++ b/src/tasks/Common/Utils.cs
@@ -64,6 +64,9 @@ static string CreateTemporaryBatchFile(string command)
using StreamWriter sw = new(file);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
+ // set encoding to UTF-8 -> full Unicode support is needed for usernames -
+ // `command` contains tmp dir path with the username
+ sw.WriteLine(@"%SystemRoot%\System32\chcp.com 65001>nul");
sw.WriteLine("setlocal");
sw.WriteLine("set errorlevel=dummy");
sw.WriteLine("set errorlevel=");
@@ -187,29 +190,6 @@ public static (int, string) TryRunProcess(
return (process.ExitCode, outputBuilder.ToString().Trim('\r', '\n'));
}
- internal static string CreateTemporaryBatchFile(string command)
- {
- string extn = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".cmd" : ".sh";
- string file = Path.Combine(Path.GetTempPath(), $"tmp{Guid.NewGuid():N}{extn}");
-
- using StreamWriter sw = new(file);
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- sw.WriteLine("setlocal");
- sw.WriteLine("set errorlevel=dummy");
- sw.WriteLine("set errorlevel=");
- }
- else
- {
- // Use sh rather than bash, as not all 'nix systems necessarily have Bash installed
- sw.WriteLine("#!/bin/sh");
- }
-
- sw.WriteLine(command);
-
- return file;
- }
-
public static bool CopyIfDifferent(string src, string dst, bool useHash)
{
if (!File.Exists(src))
diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/BlazorWasmBuildPublishTests.cs b/src/tests/BuildWasmApps/Wasm.Build.Tests/BlazorWasmBuildPublishTests.cs
index a40ef1fdd69977..09bbcf8e1d0245 100644
--- a/src/tests/BuildWasmApps/Wasm.Build.Tests/BlazorWasmBuildPublishTests.cs
+++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/BlazorWasmBuildPublishTests.cs
@@ -26,7 +26,7 @@ public BlazorWasmBuildPublishTests(ITestOutputHelper output, SharedBuildPerTestC
[InlineData("Release")]
public void DefaultTemplate_WithoutWorkload(string config)
{
- string id = $"blz_no_workload_{config}";
+ string id = $"blz_no_workload_{config}{s_unicodeChar}";
CreateBlazorWasmTemplateProject(id);
// Build
diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildPublishTests.cs b/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildPublishTests.cs
index c798c79cd041fc..66fed9a630d16b 100644
--- a/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildPublishTests.cs
+++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildPublishTests.cs
@@ -25,7 +25,7 @@ public BuildPublishTests(ITestOutputHelper output, SharedBuildPerTestClassFixtur
[BuildAndRun(host: RunHost.Chrome, aot: false, config: "Debug")]
public void BuildThenPublishNoAOT(BuildArgs buildArgs, RunHost host, string id)
{
- string projectName = $"build_publish_{buildArgs.Config}";
+ string projectName = $"build_publish_{buildArgs.Config}_{s_unicodeChar}";
buildArgs = buildArgs with { ProjectName = projectName };
buildArgs = ExpandBuildArgs(buildArgs);
diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildTestBase.cs b/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildTestBase.cs
index f0dc3d3457ea91..4805396442a6c8 100644
--- a/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildTestBase.cs
+++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/BuildTestBase.cs
@@ -29,6 +29,7 @@ public abstract class BuildTestBase : IClassFixture