From c5d8837724f843b7a7555ca6697a43179a0a7715 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Wed, 31 May 2023 02:31:42 +0700 Subject: [PATCH 1/4] Revert "Set Version for Windows (#15238)" This reverts commit 130f7884327b490332d0094d87521c0a91c9a18f. --- src/Core/src/nuget/buildTransitive/WinUI.targets | 8 ++++++++ .../Sdk/Microsoft.Maui.Sdk.Before.targets | 9 --------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Core/src/nuget/buildTransitive/WinUI.targets b/src/Core/src/nuget/buildTransitive/WinUI.targets index d82a5b31dbd7..e6a9d3e59b13 100644 --- a/src/Core/src/nuget/buildTransitive/WinUI.targets +++ b/src/Core/src/nuget/buildTransitive/WinUI.targets @@ -1,6 +1,14 @@ + + + $(ApplicationDisplayVersion) + + <_ReferenceRelatedPaths diff --git a/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.Before.targets b/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.Before.targets index 7f68a95e8c37..9c41f276d316 100644 --- a/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.Before.targets +++ b/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.Before.targets @@ -19,13 +19,4 @@ <_MauiUsingDefaultRuntimeIdentifier>true - - - $(ApplicationDisplayVersion) - - From 3a637b75a838c0eb064788c25d68770eb66fd8bf Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Wed, 31 May 2023 02:31:54 +0700 Subject: [PATCH 2/4] Add the test --- .../TemplateTests.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs index 65816ddec731..9ad9d9503c01 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs @@ -121,6 +121,33 @@ public void BuildWithoutPackageReference(string id, string framework, string con $"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors."); } + [Test] + [TestCase("maui", "Debug", "2.0", "2")] + [TestCase("maui", "Release", "2.0", "2")] + [TestCase("maui", "Release", "0.3", "3")] + [TestCase("maui-blazor", "Debug", "2.0", "2")] + [TestCase("maui-blazor", "Release", "2.0", "2")] + [TestCase("maui-blazor", "Release", "0.3", "3")] + public void BuildWithDifferentVersionNumber(string id, string config) + { + var projectDir = TestDirectory; + var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); + + Assert.IsTrue(DotnetInternal.New(id, projectDir), + $"Unable to create template {id}. Check test output for errors."); + + EnableTizen(projectFile); + FileUtilities.ReplaceInFile(projectFile, + "1.0", + "2.0"); + FileUtilities.ReplaceInFile(projectFile, + "1", + "2"); + + Assert.IsTrue(DotnetInternal.Build(projectFile, config, properties: BuildProps), + $"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors."); + } + void EnableTizen(string projectFile) { FileUtilities.ReplaceInFile(projectFile, new Dictionary() From e811596650d47b50d3239fbf70644e0ca467d52a Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Wed, 31 May 2023 03:33:25 +0700 Subject: [PATCH 3/4] tbis --- .../Utilities/DotnetInternal.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/Utilities/DotnetInternal.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/Utilities/DotnetInternal.cs index 269747a17f20..b080e80d20c5 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/Utilities/DotnetInternal.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/Utilities/DotnetInternal.cs @@ -37,9 +37,14 @@ public static bool Build(string projectFile, string config, string target = "", return Run("build", $"{buildArgs} -bl:\"{binlogPath}\""); } - public static bool New(string shortName, string outputDirectory, string framework) + public static bool New(string shortName, string outputDirectory, string framework = "") { - var output = RunForOutput("new", $"{shortName} -o \"{outputDirectory}\" -f {framework}", out int exitCode, timeoutInSeconds: 300); + var args = $"{shortName} -o \"{outputDirectory}\""; + + if (!string.IsNullOrEmpty(framework)) + args += $" -f {framework}"; + + var output = RunForOutput("new", args, out int exitCode, timeoutInSeconds: 300); TestContext.WriteLine(output); return exitCode == 0; } From 9083ba356f9821221a4bc07f9f34f74fcc173efd Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Wed, 31 May 2023 20:30:12 +0700 Subject: [PATCH 4/4] oops --- .../Microsoft.Maui.IntegrationTests/TemplateTests.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs index 9ad9d9503c01..794cdf033133 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs @@ -128,7 +128,7 @@ public void BuildWithoutPackageReference(string id, string framework, string con [TestCase("maui-blazor", "Debug", "2.0", "2")] [TestCase("maui-blazor", "Release", "2.0", "2")] [TestCase("maui-blazor", "Release", "0.3", "3")] - public void BuildWithDifferentVersionNumber(string id, string config) + public void BuildWithDifferentVersionNumber(string id, string config, string display, string version) { var projectDir = TestDirectory; var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); @@ -138,11 +138,11 @@ public void BuildWithDifferentVersionNumber(string id, string config) EnableTizen(projectFile); FileUtilities.ReplaceInFile(projectFile, - "1.0", - "2.0"); + $"1.0", + $"{display}"); FileUtilities.ReplaceInFile(projectFile, - "1", - "2"); + $"1", + $"{version}"); Assert.IsTrue(DotnetInternal.Build(projectFile, config, properties: BuildProps), $"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");