From c33ef707421fbc24e501e1bd1e1045a1ede81f57 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Fri, 5 Dec 2025 23:08:48 +0200 Subject: [PATCH 1/3] Fix the Aspire ServiceDefaults project template --- .../Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs index 85898ea1df33..00b4ed7d105c 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs @@ -324,6 +324,10 @@ public void AspireServiceDefaultsTemplateUsesCorrectProjectName(string projectNa Assert.IsTrue(DotnetInternal.New("maui-aspire-servicedefaults", projectDir, additionalDotNetNewParams: $"-n \"{projectName}\""), $"Unable to create template maui-aspire-servicedefaults. Check test output for errors."); + // Verify the project actually builds + Assert.IsTrue(DotnetInternal.Build(expectedProjectFile, "Debug", properties: BuildProps, msbuildWarningsAsErrors: true), + $"Project {Path.GetFileName(expectedProjectFile)} failed to build. Check test output/attachments for errors."); + // Verify the project file was created with the correct name (this was the bug) Assert.IsTrue(File.Exists(expectedProjectFile), $"Expected project file '{expectedProjectFile}' was not created. This indicates the template naming issue."); @@ -340,9 +344,11 @@ public void AspireServiceDefaultsTemplateUsesCorrectProjectName(string projectNa Assert.IsTrue(File.Exists(Path.Combine(projectDir, "Extensions.cs")), "Expected Extensions.cs file was not created."); - // Verify we can build it (even if restore fails due to placeholder tokens, the project structure should be valid) + // Verify the project file contains required properties var projectContent = File.ReadAllText(expectedProjectFile); Assert.IsTrue(projectContent.Contains("true", StringComparison.Ordinal), "Project file should contain Aspire-specific properties."); + Assert.IsTrue(projectContent.Contains("true", StringComparison.Ordinal), + "Project file should contain UseMauiCore property."); } } From 5ea53fbb9b5d43dc49ef3ec43ddc26ef9b31e7dd Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sat, 6 Dec 2025 01:03:11 +0200 Subject: [PATCH 2/3] fix the issue --- .../MauiAspire.1.ServiceDefaults.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Templates/src/templates/maui-aspire-servicedefaults/MauiAspire.1.ServiceDefaults.csproj b/src/Templates/src/templates/maui-aspire-servicedefaults/MauiAspire.1.ServiceDefaults.csproj index d011350b2f8d..f77b00466a57 100644 --- a/src/Templates/src/templates/maui-aspire-servicedefaults/MauiAspire.1.ServiceDefaults.csproj +++ b/src/Templates/src/templates/maui-aspire-servicedefaults/MauiAspire.1.ServiceDefaults.csproj @@ -5,6 +5,7 @@ enable enable true + true From 1b3c1285e1abf4828154528d0c8a225d78bc4009 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sat, 6 Dec 2025 03:16:51 +0200 Subject: [PATCH 3/3] ordering --- .../Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs index 00b4ed7d105c..9311104e0b38 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs @@ -324,10 +324,6 @@ public void AspireServiceDefaultsTemplateUsesCorrectProjectName(string projectNa Assert.IsTrue(DotnetInternal.New("maui-aspire-servicedefaults", projectDir, additionalDotNetNewParams: $"-n \"{projectName}\""), $"Unable to create template maui-aspire-servicedefaults. Check test output for errors."); - // Verify the project actually builds - Assert.IsTrue(DotnetInternal.Build(expectedProjectFile, "Debug", properties: BuildProps, msbuildWarningsAsErrors: true), - $"Project {Path.GetFileName(expectedProjectFile)} failed to build. Check test output/attachments for errors."); - // Verify the project file was created with the correct name (this was the bug) Assert.IsTrue(File.Exists(expectedProjectFile), $"Expected project file '{expectedProjectFile}' was not created. This indicates the template naming issue."); @@ -350,5 +346,9 @@ public void AspireServiceDefaultsTemplateUsesCorrectProjectName(string projectNa "Project file should contain Aspire-specific properties."); Assert.IsTrue(projectContent.Contains("true", StringComparison.Ordinal), "Project file should contain UseMauiCore property."); + + // Verify the project actually builds + Assert.IsTrue(DotnetInternal.Build(expectedProjectFile, "Debug", properties: BuildProps, msbuildWarningsAsErrors: true), + $"Project {Path.GetFileName(expectedProjectFile)} failed to build. Check test output/attachments for errors."); } }