diff --git a/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets b/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
index f1d9bc21cec0..2ffceca517b5 100644
--- a/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
+++ b/src/SingleProject/Resizetizer/src/nuget/buildTransitive/Microsoft.Maui.Resizetizer.After.targets
@@ -462,6 +462,7 @@
<_MauiSplashAssets Include="$(_MauiIntermediateSplashScreen)**\*" />
%(_MauiSplashAssets.Filename)%(_MauiSplashAssets.Extension)
+ PreserveNewest
@@ -548,6 +549,7 @@
$([System.IO.Path]::GetFileName(%(_MauiFontCopied.Identity)))
+ PreserveNewest
@@ -654,6 +656,7 @@
%(_ResizetizerCollectedImages.Filename)%(_ResizetizerCollectedImages.Extension)
+ PreserveNewest
diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs
index 2c9493fd6fdf..7b40b0c2d6cd 100644
--- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs
+++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs
@@ -25,7 +25,7 @@ public string TestName
public string TestNuGetConfig => Path.Combine(TestEnvironment.GetTestDirectoryRoot(), "NuGet.config");
// Properties that ensure we don't use cached packages, and *only* the empty NuGet.config
- protected string[] BuildProps => new[]
+ protected List BuildProps => new()
{
"RestoreNoCache=true",
//"GenerateAppxPackageOnBuild=true",
diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
index 794cdf033133..4a6232732909 100644
--- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
+++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
@@ -72,6 +72,39 @@ public void BuildUnpackaged(string id, string framework, string config)
$"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
}
+ [Test]
+ [TestCase("maui", "net7.0", "Release")]
+ public void PublishUnpackaged(string id, string framework, string config)
+ {
+ if (!TestEnvironment.IsWindows)
+ Assert.Ignore("Running Windows templates is only supported on Windows.");
+
+ var projectDir = TestDirectory;
+ var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj");
+
+ Assert.IsTrue(DotnetInternal.New(id, projectDir, framework),
+ $"Unable to create template {id}. Check test output for errors.");
+
+ BuildProps.Add("WindowsPackageType=None");
+
+ Assert.IsTrue(DotnetInternal.Publish(projectFile, config, framework: $"{framework}-windows10.0.19041.0", properties: BuildProps),
+ $"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
+
+ var assetsRoot = Path.Combine(projectDir, $"bin/{config}/{framework}-windows10.0.19041.0/win10-x64/publish");
+
+ AssetExists("dotnet_bot.scale-100.png");
+ AssetExists("appiconLogo.scale-100.png");
+ AssetExists("OpenSans-Regular.ttf");
+ AssetExists("splashSplashScreen.scale-100.png");
+
+ void AssetExists(string filename)
+ {
+ var fullpath = Path.Combine(assetsRoot!, filename);
+ Assert.IsTrue(File.Exists(fullpath),
+ $"Unable to find expected asset: {fullpath}");
+ }
+ }
+
[Test]
[TestCase("mauilib", "net6.0", "Debug")]
[TestCase("mauilib", "net6.0", "Release")]
diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/Utilities/DotnetInternal.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/Utilities/DotnetInternal.cs
index b080e80d20c5..d52be328cae8 100644
--- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/Utilities/DotnetInternal.cs
+++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/Utilities/DotnetInternal.cs
@@ -37,6 +37,36 @@ public static bool Build(string projectFile, string config, string target = "",
return Run("build", $"{buildArgs} -bl:\"{binlogPath}\"");
}
+ public static bool Publish(string projectFile, string config, string target = "", string framework = "", IEnumerable? properties = null, string binlogPath = "")
+ {
+ var binlogName = $"publish-{DateTime.UtcNow.ToFileTimeUtc()}.binlog";
+ var buildArgs = $"\"{projectFile}\" -c {config}";
+
+ if (!string.IsNullOrEmpty(target))
+ {
+ binlogName = $"{target}-{DateTime.UtcNow.ToFileTimeUtc()}.binlog";
+ buildArgs += $" -t:{target}";
+ }
+
+ if (!string.IsNullOrEmpty(framework))
+ buildArgs += $" -f:{framework}";
+
+ if (properties != null)
+ {
+ foreach (var p in properties)
+ {
+ buildArgs += $" -p:{p}";
+ }
+ }
+
+ if (string.IsNullOrEmpty(binlogPath))
+ {
+ binlogPath = Path.Combine(Path.GetDirectoryName(projectFile) ?? "", binlogName);
+ }
+
+ return Run("publish", $"{buildArgs} -bl:\"{binlogPath}\"");
+ }
+
public static bool New(string shortName, string outputDirectory, string framework = "")
{
var args = $"{shortName} -o \"{outputDirectory}\"";