diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in
index cd5534f8a111b8..985e0c31cb99a6 100644
--- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in
+++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in
@@ -54,7 +54,7 @@
-
+
diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.net6.Manifest/WorkloadManifest.targets.in b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.net6.Manifest/WorkloadManifest.targets.in
index 375f86564c9151..12f408307622ab 100644
--- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.net6.Manifest/WorkloadManifest.targets.in
+++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.net6.Manifest/WorkloadManifest.targets.in
@@ -1,6 +1,6 @@
-
+
diff --git a/src/mono/wasm/Wasm.Build.Tests/HelperExtensions.cs b/src/mono/wasm/Wasm.Build.Tests/HelperExtensions.cs
index 7f36db407e2dd0..7690ce61b88052 100644
--- a/src/mono/wasm/Wasm.Build.Tests/HelperExtensions.cs
+++ b/src/mono/wasm/Wasm.Build.Tests/HelperExtensions.cs
@@ -58,6 +58,9 @@ public static class HelperExtensions
=> data.SelectMany(row =>
rowsWithColumnArrays.Select(new_cols => row.Concat(new_cols)));
+ public static IEnumerable> MultiplyWithSingleArgs(this IEnumerable> data, params object?[] arrayOfArgs)
+ => data.SelectMany(row => arrayOfArgs.Select(argCol => row.Concat(new[] { argCol })));
+
public static object?[] Enumerate(this RunHost host)
{
if (host == RunHost.None)
diff --git a/src/mono/wasm/Wasm.Build.Tests/NonWasmTemplateBuildTests.cs b/src/mono/wasm/Wasm.Build.Tests/NonWasmTemplateBuildTests.cs
new file mode 100644
index 00000000000000..22f0fa44c7d1b5
--- /dev/null
+++ b/src/mono/wasm/Wasm.Build.Tests/NonWasmTemplateBuildTests.cs
@@ -0,0 +1,132 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Xunit;
+using Xunit.Abstractions;
+
+#nullable enable
+
+namespace Wasm.Build.Tests;
+
+public class NonWasmTemplateBuildTests : BuildTestBase
+{
+ public NonWasmTemplateBuildTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildContext)
+ : base(output, buildContext)
+ {
+ }
+
+ // For building non-wasm project with the sdk installed, we need to
+ // patch the framework references. But we want to maintain the versions.
+ // So, copy the reference for latest TFM, and add that back with the
+ // TFM=DefaultTargetFramework
+ //
+ // This is useful for the case when we are on tfm=net7.0, but sdk, and packages
+ // are really 8.0 .
+ private const string s_latestTargetFramework = "net8.0";
+ private const string s_previousTargetFramework = "net7.0";
+ private static string s_directoryBuildTargetsForPreviousTFM =
+ $$"""
+
+
+
+
+ <_KnownFrameworkReferenceToCopyFrom
+ Include="@(KnownFrameworkReference)"
+ Condition="'%(Identity)' == 'Microsoft.NETCore.App' and '%(TargetFramework)' == '{{s_latestTargetFramework}}'" />
+
+ <_KnownFrameworkReferenceToCopyFrom Update="@(_KnownFrameworkReferenceToCopyFrom)" TargetFramework="{{DefaultTargetFramework}}" />
+
+
+
+
+
+
+
+
+ """;
+
+ private static string s_directoryBuildTargetsForCurrentTFM = "";
+
+ public static IEnumerable