diff --git a/Directory.Build.targets b/Directory.Build.targets
index b6c48d5223..5feebecca5 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -76,7 +76,7 @@
-
+
diff --git a/src/Core/src/nuget/buildTransitive/WinUI.Unpackaged.targets b/src/Core/src/nuget/buildTransitive/WinUI.Unpackaged.targets
deleted file mode 100644
index 6ea3566ce2..0000000000
--- a/src/Core/src/nuget/buildTransitive/WinUI.Unpackaged.targets
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Invalid
- x86
- x86
- x64
- arm
- arm64
-
-
- neutral
- x86
- x64
- arm
- arm64
-
-
-
-
-
-
-
-
diff --git a/src/Core/src/nuget/buildTransitive/WinUI.targets b/src/Core/src/nuget/buildTransitive/WinUI.targets
index e6a9d3e59b..84feb76715 100644
--- a/src/Core/src/nuget/buildTransitive/WinUI.targets
+++ b/src/Core/src/nuget/buildTransitive/WinUI.targets
@@ -28,7 +28,37 @@
-
+
+
+
+
+
+
+ Invalid
+ x86
+ x86
+ x64
+ arm
+ arm64
+
+
+ neutral
+ x86
+ x64
+ arm
+ arm64
+
+
+
+
+
+
diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
index 38f0175eac..1f6592826b 100644
--- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
+++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
@@ -149,6 +149,36 @@ namespace Microsoft.Maui.IntegrationTests
$"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
}
+ [Test]
+ [TestCase("maui", true, true)]
+ [TestCase("maui", true, false)]
+ [TestCase("maui", false, true)]
+ public void BuildWindowsAppSDKSelfContained(string id, bool wasdkself, bool netself)
+ {
+ if (TestEnvironment.IsMacOS)
+ Assert.Ignore("This test is designed for testing a windows build.");
+
+ var projectDir = TestDirectory;
+ var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj");
+
+ Assert.IsTrue(DotnetInternal.New(id, projectDir, DotNetCurrent),
+ $"Unable to create template {id}. Check test output for errors.");
+
+ FileUtilities.ReplaceInFile(projectFile,
+ "true",
+ $"""
+ true
+ {wasdkself}
+ {netself}
+ """);
+
+ var extendedBuildProps = BuildProps;
+ extendedBuildProps.Add($"TargetFramework={DotNetCurrent}-windows10.0.19041.0");
+
+ Assert.IsTrue(DotnetInternal.Build(projectFile, "Release", properties: extendedBuildProps, msbuildWarningsAsErrors: true),
+ $"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
+ }
+
[Test]
[TestCase("maui", $"{DotNetCurrent}-ios", "ios-arm64")]
public void PublishNativeAOT(string id, string framework, string runtimeIdentifier)